Manager for in-game GUI
Inheritance: MonoBehaviour
コード例 #1
0
    void Update()
    {
        if (HP <= 0)
        {
            gm.Win(false);
        }
        HPSlider.value = -((HP / HPmax) * 100);
        foreach (var kp in patternBindings)
        {
            if (Input.GetKeyDown(kp.Key))
            {
                if (GameGUIManager.IsSpellcardInCooldown(kp.Value - 1))
                {
                    continue;
                }

                Debug.Log(kp.Value != activePattern);
                if (kp.Value != activePattern)
                {
                    ActivateSpellCard(kp.Value);
                }
            }
        }

        Vector2 move = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        rigidbody.velocity = move;
        transform.position = new Vector3(Mathf.Clamp(transform.position.x, -6f, 2f), Mathf.Clamp(transform.position.y, -1.5f, 4.8f), 0);
    }
コード例 #2
0
    void ActivateSpellCard(int spellcardIndex)
    {
        int oldActivePattern = activePattern;

        activePattern = spellcardIndex;

        foreach (var particleSystem in patterns[oldActivePattern].particleSystems)
        {
            var emission = particleSystem.emission;
            particleSystem.Stop();
            emission.enabled = false;
        }

        foreach (var particleSystem in patterns[activePattern].particleSystems)
        {
            var emission = particleSystem.emission;
            particleSystem.Play();
            emission.enabled = true;
        }

        if (spellcardIndex != 0)
        {
            GameGUIManager.ActivateSpellCard(activePattern - 1, patterns[activePattern].cooldown, patterns[activePattern].duration);
            StartCoroutine(RestartDefaultPattern(patterns[activePattern].duration));
        }
    }
コード例 #3
0
 void Awake()
 {
     if (mInst == null)
     {
         mInst = this;
     }
     //DontDestroyOnLoad(this);
 }
コード例 #4
0
ファイル: GameGUIManager.cs プロジェクト: wids-eria/tf_client
	/// <summary>
	/// Initialize
	/// </summary>
	void Awake()
	{
		if (use != null) {
			Destroy(use.gameObject);
		}
		use = this;
		MessengerAM.Listen("game flow", this);
		MessengerAM.Listen(MessengerAM.listenTypeConfig, this);
		Messenger<int>.AddListener(BottomTrayGUI.kPaintSelectionInputMode, SetInputSelection);
		InitializeGUI(); // just add a call to this here too, so things that need public attributes will have them before Start() is called
	}
コード例 #5
0
ファイル: GameGUIManager.cs プロジェクト: nixjoe/ULRisk
    private void Awake()
    {
        if (instance == null)
        {
            //If I am the first instance, make me the Singleton
            instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            Destroy(this.gameObject);
        }

        base.Awake();
    }
コード例 #6
0
ファイル: Shooting.cs プロジェクト: Derfiloulou/ProjectFPS
    // Use this for initialization
    void Start()
    {
        nView                   = GetComponent <NetworkView>();
        cam                     = GetComponentInChildren <Camera>();
        originAudio             = shotOrigin.GetComponent <AudioSource>();
        playerAudio             = GetComponent <AudioSource>();
        hitSound                = GameSoundManager.instance.hit;
        shotSound               = GameSoundManager.instance.shot;
        gameGUIManager          = GameGUIManager.instance;
        fps                     = GetComponent <FirstPersonController>();
        shootAnim               = GetComponentInChildren <Animator>();
        shotLight               = GetComponent <Light>();
        shotSystem              = shotOrigin.GetComponent <ParticleSystem>();
        weaponRenderer          = weapon.GetComponent <Renderer>();
        weaponRenderer.material = new Material(Shader.Find("Diffuse"));

        shotDispersion                = 0;
        currentShotLevelInt           = 0;
        currentShotLevel              = shotLevels[0];
        bulletsForThisLevel           = shotLevels[0].availableBullets;
        weaponRenderer.material.color = shotLevels[0].colorRay;
        availableBulletsText.text     = bulletsForThisLevel.ToString();
    }
コード例 #7
0
 void Awake()
 {
     instance = this;
 }