예제 #1
0
        public void Initialize(IGameInterface gameInterface, int creatureId, int animationId)
        {
            this.gameInterface = gameInterface;
            this.CreatureId    = creatureId;

            this.AnimateState = AnimateStates.Idle;

            icon1 = AssetManager.Instance().InstantiateIconGO(this.transform, animationId, 1);
            icon2 = AssetManager.Instance().InstantiateIconGO(this.transform, animationId, 2);
            icon3 = AssetManager.Instance().InstantiateIconGO(this.transform, animationId, 3);

            var box = this.gameObject.AddComponent <BoxCollider>();

            box.size   = new Vector3(2.0f, 2.0f, 2.0f);
            box.center = new Vector3(0f, 1f, 0f);
        }
예제 #2
0
        public void SetAnimateState(AnimateStates state)
        {
            switch (state)
            {
            case AnimateStates.Idle:
                this.transform.localRotation = new Quaternion(0, 1.0f, 0, 0);
                break;

            case AnimateStates.Dying:
                this.transform.localRotation = new Quaternion(0, 1.0f, 0, 0);
                dyingStartTimestamp          = Time.time;
                icon1.SetActive(false);
                icon2.SetActive(true);
                icon3.SetActive(false);
                break;

            case AnimateStates.WalkLeft:
                this.transform.localRotation = new Quaternion(0, -0.7f, 0, 0.7f);
                break;

            case AnimateStates.WalkRight:
                this.transform.localRotation = new Quaternion(0, 0.7f, 0, 0.7f);
                break;

            case AnimateStates.WalkUp:
                this.transform.localRotation = new Quaternion(0, 0f, 0, 0);
                break;

            case AnimateStates.WalkDown:
                this.transform.localRotation = new Quaternion(0, 1.0f, 0, 0);
                break;

            default:
                break;
            }

            this.AnimateState = state;
        }