Exemple #1
0
        public override void OnInit()
        {
            objectFeature = Entity.GetFeature <ObjectFeature>();

            position = objectFeature.position;
            rotation = objectFeature.rotation;

            RegisterMessage(MessageID.PositionUpdate, (IBody body) => {
                if (debug)
                {
                    Debug.Log("message position update");
                }
                position = (body as Vector3Body).value;
            });

            RegisterMessage(MessageID.RotationUpdate, (IBody body) => {
                if (debug)
                {
                    Debug.Log("message rotation update");
                }
                rotation = (body as QuaternionBody).value;
            });

            RegisterFixedUpdate(OnFixedUpdate);
        }
Exemple #2
0
        public override void OnInit()
        {
            objectFeature   = Entity.GetFeature <ObjectFeature>();
            playerTransform = objectFeature.GetComponent <PlayerTransform>();

            RegisterUpdate(OnUpdate);
            RegisterFixedUpdate(OnFixedUpdate);
            // 初始化Last
            lastPosition = objectFeature.transform.position;
            lastRotation = objectFeature.transform.rotation;
        }
        public override void OnInit()
        {
            objectFeature  = Entity.GetFeature <ObjectFeature>();
            swordCollision = objectFeature.GetComponent <SwordCollision>();

            RegisterMessage(MessageID.PlayerAttack, (IBody body) => {
                if (debug)
                {
                    Debug.Log("message start attack");
                }
                AttackStart(body as UintBody);
            });
        }