コード例 #1
0
        public override void AwakeOnServer()
        {
            var rigidBody = GetComponent <Rigidbody>();

            if (rigidBody == null)
            {
                throw new NullReferenceException();
            }

            ServerSession.Instance.AddPlayerEntity(this);

            BodyModule.Initialize(this);
            MoveModule.Initialize(this);
            MoveModule.Setup(this, rigidBody);
            AnimationModule.Initialize(this);

            BodyModule.OnStateChanged      += OnStateChanged;
            MoveModule.OnStateChanged      += OnStateChanged;
            AnimationModule.OnStateChanged += OnStateChanged;
        }
コード例 #2
0
        public override void AwakeOnClient()
        {
            var rigidBody = GetComponent <Rigidbody>();

            if (rigidBody == null)
            {
                throw new NullReferenceException();
            }

            rigidBody.useGravity = false;

            BodyModule.Initialize(this);
            MoveModule.Initialize(this);
            MoveModule.Setup(this, rigidBody);
            AnimationModule.Initialize(this);

            definedModules.Add(BodyModule.ID, BodyModule);
            definedModules.Add(MoveModule.ID, MoveModule);
            definedModules.Add(AnimationModule.ID, AnimationModule);
        }