Ejemplo n.º 1
0
    public void setModes(GameObject[] headOff, GameObject[] headOn, GameObject[] torsoOnRight, GameObject[] torsoOnLeft, GameObject[] fullTorsoRight, GameObject[] fullTorsoLeft, GameObject[] fullBodyRight, GameObject[] fullBodyLeft, GameObject[] pushingLeft, GameObject[] pushingRight, GameObject lightOff, GameObject lightOn)
    {
        this.headOff        = headOff;
        this.headOn         = headOn;
        this.torsoOnRight   = torsoOnRight;
        this.torsoOnLeft    = torsoOnLeft;
        this.fullTorsoRight = fullTorsoRight;
        this.fullTorsoLeft  = fullTorsoLeft;
        this.fullBodyRight  = fullBodyRight;
        this.fullBodyLeft   = fullBodyLeft;
        this.pushingLeft    = pushingLeft;
        this.pushingRight   = pushingRight;

        this.lightOff = lightOff;
        this.lightOn  = lightOn;

        walkCycle    = new WalkCycleScript(headOff);
        advancedWalk = new LeftnRightWalkScript(torsoOnLeft, torsoOnRight);
        advancedWalk.deactive();
        advancedWalk.deactive(fullTorsoLeft, fullTorsoRight);
        advancedWalk.deactive(fullBodyLeft, fullBodyRight);
        advancedWalk.deactive(pushingLeft, pushingRight);
        walkCycle.deactive(headOn);
        walkCycle.deactive(torsoOnRight);
        walkCycle.deactive(torsoOnLeft);
        lightOff.SetActive(true);
        lightOn.SetActive(false);
    }
    void Start()
    {
        /* Setting variable defaults.
         * Creating WalkCycleScript class object.
         * And setting starting sprite to face Up.
         */

        rigidbody2d   = GetComponent <Rigidbody2D>();
        currentHealth = 5;
        freeze        = false; firstYHit = false; firstXHit = false; yDown = false;
        yUp           = false; xLeft = false; xRight = false;
        walk          = new WalkCycleScript(runUp, runDown, runRight, runLeft);
        count         = new CountingScript();
        gameCtrl      = GameController.Instance;

        walk.Deactive(runUp);
        walk.Deactive(runDown);
        walk.Deactive(runRight);
        walk.Deactive(runLeft);
        walk.setStartingPos(runUp);

        checkRoom();
        setPosition();
    }