void InitAction(_action Action) { Color clr = Color.black; switch (Action) { case _action.None: break; case _action.FadeFromBlack: blackScreen.SetActive(true); alpha = 1; clr.a = alpha; blackScreen.GetComponent <SpriteRenderer> ().renderer.material.color = clr; break; case _action.FadeToBlack: blackScreen.SetActive(true); alpha = 0; clr.a = alpha; blackScreen.GetComponent <SpriteRenderer> ().renderer.material.color = clr; break; default: break; } }
void HandleAction(_action Action) { Color clr = Color.black; switch (Action) { case _action.None: break; case _action.FadeFromBlack: alpha -= Time.deltaTime / Cinematic[entryIndex - 1].ShowTime; clr.a = alpha; blackScreen.GetComponent <SpriteRenderer> ().renderer.material.color = clr; break; case _action.FadeToBlack: alpha += Time.deltaTime / Cinematic[entryIndex - 1].ShowTime; clr.a = alpha; blackScreen.GetComponent <SpriteRenderer> ().renderer.material.color = clr; break; default: break; } }
void SetAction(_action changeAct) { foreach (GameObject go in animObjects) { go.GetComponent <Animator>().SetInteger("Action", (int)changeAct); } }
// Update is called once per frame void Update() { if (lastChange < Time.time) { foreach (GameObject go in animObjects) { go.GetComponent <Animator>().SetInteger("Direction", (int)Dir); go.GetComponent <Animator>().SetInteger("Action", (int)Act); go.GetComponent <Animator>().SetBool("ChangeAnim", true); } lastChange = Time.time + 3f; Dir++; if ((int)Dir > 3) { Dir = 0; Act++; if ((int)Act > 4) { Act = 0; } } } }
// Update is called once per frame void Update() { if (lastChange < Time.time) { GetComponent <Animator>().SetInteger("Direction", (int)Dir); GetComponent <Animator>().SetInteger("Action", (int)Act); GetComponent <Animator>().SetBool("ChangeAnim", true); lastChange = Time.time + 3f; Dir++; if ((int)Dir > 3) { Dir = 0; Act++; if ((int)Act > 4) { Act = 0; } } } }
set => SetProperty(ref _action, value);
// Use this for initialization void Start() { Dir = _direction.DirUp; Act = _action.Idle; lastChange = -1; }