Exemple #1
0
    protected void Start()
    {
        body       = GetComponent <ChipmunkBody>();
        controller = GetComponent <SideScrollerController>();

        if (body == null)
        {
            Debug.LogError("Your PlayerController is not configured properly! Add a body!");
        }

        startPos    = body.position;
        spriteScale = sprite.transform.localScale;
    }
        public void ConfigFighterControllers(int playerID, ControllerMode mode)
        {
            // Get Controller Components

            SideScrollerController controller1 = fighter1.GetComponent <SideScrollerController>();
            SideScrollerController controller2 = fighter2.GetComponent <SideScrollerController>();

            if (controller1 == null || controller2 == null)
            {
                Debug.LogAssertion(" No Controlers Found ");
                return;
            }

            //Config AI Players
            if (mode == ControllerMode.AI_PLAYER)
            {
                if (playerID == 1)
                {
                    controller1.SetCharacterControllerAsAI(standardProfile);
                }
                if (playerID == 2)
                {
                    controller2.SetCharacterControllerAsAI(standardProfile);
                }

                return;
            }

            // Config Local Players
            if (playerID == 1)
            {
                controller1.currentMode = mode;
            }
            if (playerID == 2)
            {
                controller2.currentMode = mode;
            }
            return;
        }
        private void ConfigFighterControllers(bool controllersEnabled)
        {
            // Get Controller Components

            SideScrollerController controller1 = fighter1.GetComponent <SideScrollerController>();
            SideScrollerController controller2 = fighter2.GetComponent <SideScrollerController>();

            if (controller1 == null || controller2 == null)
            {
                Debug.LogAssertion(" No Controlers Found ");
                return;
            }

            // Deactivate Players for Intro Sequence (bool)

            controller1.enabled = controllersEnabled;
            controller2.enabled = controllersEnabled;

            // Set Fighters to Stand Still
            controller1.SetCharacterToStandStill();
            controller2.SetCharacterToStandStill();
        }