Example #1
0
    void OnTriggerExit(Collider other)
    {
        currentActionButtonState = ActionButtonStates.NONE;

        /* Am I leaving the range of a vortex? */
        if (IsVortex(other.gameObject)) {
            nearVortex = false;
        }
        else if (IsJump(other.gameObject)) {
            maxVelocityY = 19.0f;
        }
    }
Example #2
0
    void OnTriggerStay(Collider other)
    {
        /* If other is the collider of a player event, then activate the event if possible. */
        if (IsPlayerEvent(other.gameObject)) {

                PlayerEvent playerEvent = other.gameObject.GetComponent<PlayerEvent>();
                playerEvent.OnActivate(this);
        }

        /* If other is the collider of an goal object, then win the level if possible. */
        if (IsGoal(other.gameObject)) {
            if (Input.GetButtonDown("Action1")) {
                Goal goal = other.gameObject.GetComponent<Goal>();
                goal.OnActivate(this);
                currentActionButtonState = ActionButtonStates.WON;
            }
            else if (currentActionButtonState != ActionButtonStates.WON) {
                currentActionButtonState = ActionButtonStates.CAN_WIN;
            }
        }
        /* If other is the collider of an object you can pick up, then pick it up if possible. */
        else if (CanPickup(other.gameObject)) {
            if (Input.GetButtonUp("Action1")) {
                Pickup triggeredPickup = other.gameObject.GetComponent<Pickup>();
                GetPickup(triggeredPickup);
                currentActionButtonState = ActionButtonStates.CAN_DROP;
            }
            else {
                if (IsPlant(other.gameObject)) {
        //					Debug.Log ("IsPlant!");
                    currentActionButtonState = ActionButtonStates.CAN_PICKUP_PLANT;
                }
                else {
                    currentActionButtonState = ActionButtonStates.CAN_PICKUP_BOUNCER;
                }
            }
        }
        /* If other is the collider of a Vortex, then warp if possible. */
        else if (CanWarp()) {
            //Debug.Log ("Near portal!");
            if (Input.GetButtonDown("Action1")) {
                Vortex triggeredVortex = other.gameObject.GetComponent<Vortex>();

                Warp(triggeredVortex);
            }
            currentActionButtonState = ActionButtonStates.CAN_ACTIVATE_VORTEX;
        }

        else if (other.tag.CompareTo("Finish") == 0) {
            //Debug.Log ("Winner!");
            Application.LoadLevel("scene_prototype_win");
        }

        else if (IsJump(other.gameObject)) {
            /*float tempFactor = other.gameObject.GetComponent<HyperJump_2>().currentJumpFactor;
            if (LevelManager.IsPast()) {
                if (this.transform.childCount > 4) {
                    Body tempBody = other.gameObject.GetComponent<FSBodyComponent>().PhysicsBody;
                    if (tempBody.UserData != "HyperJump") {
                        maxVelocityY = 50.0f;
                    }
                }
                else {
                    maxVelocityY = 50.0f;
                }
            }*
            Debug.Log("Stapler: " + transform.childCount);

            if (this.transform.childCount > 4) {
                Debug.Log("Copier");
                Body temp = transform.GetChild(4).GetComponent<FSBodyComponent>().PhysicsBody;
                if (temp.UserTag == "HyperJump") {
                    Debug.Log("Why not?");
                    maxVelocityY = 19.0f;
                }
            }

            Debug.Log("blah");*/
        }
    }
Example #3
0
    /* Handle any additional logic that the player may need to. */
    private void HandleExtraLogic()
    {
        /* If carrying pickup and can drop it... */
        if (CarryingPickup() && CanDropCarriedPickup()) {

            /* Drop pickup if applicable. */
            if (Input.GetButton("Action1")) {
                DropPickup();
                currentActionButtonState = ActionButtonStates.NONE;
            }
            else {
                currentActionButtonState = ActionButtonStates.CAN_DROP;
            }
        }

        /* Decrement cooldown time remaining for interacting with pickups. */
        pickupCooldownTimeRemaining -= Time.deltaTime;
        pickupCooldownTimeRemaining = Math.Max(0.0f, pickupCooldownTimeRemaining);

        /* Decrement cooldown time remaining for interacting with vortexes. */
        vortexCooldownTimeRemaining -= Time.deltaTime;
        vortexCooldownTimeRemaining = Math.Max(0.0f, vortexCooldownTimeRemaining);
    }