Skip to content

Instantly share code, notes, and snippets.

View ChunChunMorning's full-sized avatar

あさちゅん ChunChunMorning

View GitHub Profile
@ChunChunMorning
ChunChunMorning / FlashingGraphic.cs
Last active December 11, 2015 06:24
点滅するuGUI
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class FlashingGraphic : MonoBehaviour
{
[SerializeField] Graphic m_Graphics;
[SerializeField] float m_AngularFrequency = 1.0f;
[SerializeField] float m_DeltaTime = 0.0333f;
Coroutine m_Coroutine;
@ChunChunMorning
ChunChunMorning / Sample.cs
Last active December 11, 2015 06:23
UnityのEventSystemを操る No1
void ChangeInput()
{
var sim = GameObject.FindObjectOfType<StandaloneInputModule> ()
sim.horizontalAxis = "XAxis";
sim.verticalAxis = "YAxis";
sim.submitButton = "ButtonA";
sim.cancelButton = "ButtonB";
}
@ChunChunMorning
ChunChunMorning / Sample.cs
Last active December 11, 2015 06:22
UnityのEventSystemを操る No2
void Animation(GameObject selected)
{
var eventSystem = GameObject.FindObjectOfType<EventSystem> ();
eventSystem.enabled = false;
// Animation
eventSystem.enabled = true;
eventSystem.SetSelectedGameObject (selected);
}
@ChunChunMorning
ChunChunMorning / Axis.hpp
Last active August 19, 2016 14:10
Siv3Dでキーボードとゲームパッドの両方に簡単に対応させる No1
# include <Siv3D.hpp>
enum class GamepadAxis
{
X, Y, Z, R, U, V
};
enum class XInputAxis
{
LeftThumbX, LeftThumbY, RightThumbX, RightThumbY
@ChunChunMorning
ChunChunMorning / Axis.cpp
Last active December 15, 2015 15:57
Siv3Dでキーボードとゲームパッドの両方に簡単に対応させる No2
# include <Siv3D.hpp>
# include "Axis.cpp"
class Axis::CAxis
{
public:
virtual operator double() const = 0;
};
@ChunChunMorning
ChunChunMorning / AxisCombination.hpp
Last active December 15, 2015 15:58
Siv3Dでキーボードとゲームパッドの両方に簡単に対応させる No3
# include <Siv3D.hpp>
class AxisCombination
{
private:
Array<Axis> m_axes;
template <typename Type, typename ... Args>
void append(const Type& axis, const Args& ... args)
@ChunChunMorning
ChunChunMorning / AxisCombination.cpp
Last active December 15, 2015 15:58
Siv3Dでキーボードとゲームパッドの両方に簡単に対応させる No4
# include <Siv3D.hpp>
# include "AxisCombination.hpp"
void AxisCombination::append() {}
void AxisCombination::append(Axis axis)
{
m_axes.push_back(axis);
}
@ChunChunMorning
ChunChunMorning / Main.cpp
Last active December 15, 2015 15:59
Siv3Dでキーボードとゲームパッドの両方に簡単に対応させる No5
# include <Siv3D.hpp>
# include "AscInput.hpp"
using namespace asc;
void Main()
{
asc::Input input;
Gamepad gamepad(0);
XInput xinput(0);
@ChunChunMorning
ChunChunMorning / AscInput.hpp
Last active December 10, 2015 10:20
Siv3Dでキーボードとゲームパッドの両方に簡単に対応させるAscInputクラス No6
# include <Siv3D.hpp>
# include "AscAxis.hpp"
namespace asc
{
using namespace s3d;
class Input
{
@ChunChunMorning
ChunChunMorning / AscInput.cpp
Last active December 15, 2015 15:59
Siv3Dでキーボードとゲームパッドの両方に簡単に対応させる No7
# include <Siv3D.hpp>
# include <unordered_map>
# include "AscAxis.hpp"
# include "AscInput.hpp"
namespace asc
{
class Input::CInput
{