Ejemplo n.º 1
0
 void OnTriggerExit2D(Collider2D col)
 {
     if (col.tag.Equals("deflater"))
     {
         IsTouchingDeflater = false;
         currentDeflater.StartContracting();
     }
     else if (col.tag.Equals("deflater cover"))
     {
         IsTouchingDeflaterCover = false;
         //Start expanding the inflater
         if (IsTouchingDeflater)
         {
             currentDeflater.StartExpanding();
         }
         else
         {
             currentDeflater = null;
         }
     }
     else if (col.name.Equals("click detector"))
     {
         if (col.tag.Equals("rest") && WasRestGood)
         {
             currentIndicator.ChangeColor(Color.green);
             manager.IncreaseScore(10);
         }
         WasRestGood      = true;
         currentIndicator = null;
     }
 }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     //currentLevel = Instantiate(levels[0], levels[0].transform.position, Quaternion.identity);
     //levelCounter++;
     initialLevelPosition = new Vector3(currentLevel.transform.position.x, currentLevel.transform.position.y, currentLevel.transform.position.z);
     cameraOrbitScript    = mainCamera.GetComponent <CameraOrbit>();
     mind      = FindObjectOfType <MindControlController>();
     indicator = mind.GetComponent <ClickIndicator>();
 }
Ejemplo n.º 3
0
    void Awake()
    {
        level          = FindObjectOfType(typeof(Level)) as Level;
        inputHandler   = FindObjectOfType(typeof(InputHandler)) as InputHandler;
        camOrbit       = FindObjectOfType(typeof(CameraOrbit)) as CameraOrbit;
        player         = FindObjectOfType(typeof(Player)) as Player;
        clickIndicator = FindObjectOfType(typeof(ClickIndicator)) as ClickIndicator;
        uimanager      = FindObjectOfType(typeof(UIManager)) as UIManager;
        sChanger       = FindObjectOfType(typeof(SceneChanger)) as SceneChanger;

        if (level != null)
        {
            IsNotInLevel = CheckElementsInLevel(level);
        }
    }
Ejemplo n.º 4
0
 void Start()
 {
     rigidbody               = GetComponent <Rigidbody2D> ();
     current                 = InstructionState.none;
     rigidbody.velocity      = new Vector2(0, 0);
     IsTouchingDeflater      = false;
     IsTouchingDeflaterCover = false;
     currentDeflater         = null;
     currentIndicator        = null;
     IsOnGround              = false;
     ResidualClick           = false;
     WasRestGood             = true;
     Time.timeScale          = 0;
     TurnOffGround           = false;
 }
Ejemplo n.º 5
0
 void Start()
 {
     mainCamera     = Camera.main;
     clickIndicator = GetComponent <ClickIndicator>();
     //TargetPos = Vector3.zero;
 }
Ejemplo n.º 6
0
 public void IndicateClick(ClickIndicator indicator, Color color)
 {
     indicator.ChangeColor(color);
 }
Ejemplo n.º 7
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.name.Equals("click detector"))
        {
            //Assign the click indicator
            currentIndicator = col.transform.parent.GetChild(0).GetChild(1).GetComponent <ClickIndicator>();
            if (col.tag.Equals("quarter"))
            {
                current = InstructionState.quarter_note;
            }
            else if (col.tag.Equals("half"))
            {
                current = InstructionState.half_note;
            }
            else if (col.tag.Equals("eight note 1"))
            {
                current = InstructionState.eight_note_1;
            }
            else if (col.tag.Equals("eight note 2"))
            {
                current = InstructionState.eight_note_2;
            }
            else if (col.tag.Equals("rest"))
            {
                current = InstructionState.rest;
                currentIndicator.ChangeColor(Color.yellow);
            }
            else if (col.tag.Equals("whole"))
            {
                current          = InstructionState.whole;
                manager.groundY -= manager.stepHeight;
            }
        }

        if (col.tag.Equals("flag"))
        {
            manager.SetGameState(GameManager.GameState.FINISHED);
        }

        if (col.tag.Equals("soundbar"))
        {
            manager.playBeat();
        }
        else if (col.tag.Equals("musicbar"))
        {
            manager.playMusic();
        }
        else if (col.tag.Equals("deflater"))
        {
            IsTouchingDeflater = true;
        }
        else if (col.tag.Equals("deflater cover"))
        {
            IsTouchingDeflaterCover = true;
            currentDeflater         = col.GetComponentInParent <DeflaterManager> ();
        }
        else if (col.tag.Equals("pogo") || col.tag.Equals("last pogo"))
        {
            if (Input.GetMouseButton(0))
            {
                rigidbody.gravityScale = gravityScaleSingleJump;
                manager.OnBallTouchPogo(
                    col.transform.parent.GetChild(1),
                    velocity,
                    rigidbody.gravityScale * 9.81f
                    );
            }
            if (col.tag.Equals("pogo"))
            {
                if (Input.GetMouseButton(0))
                {
                    manager.IncreaseScore(10);
                }
            }
            else
            {
                if (Input.GetMouseButton(0))
                {
                    TurnOffGround = true;
                    manager.IncreaseScore(5);
                }
            }
        }
        if (col.tag.Equals("pogo"))
        {
            manager.groundY -= manager.stepHeight;
        }

        // For tutorial
        if (col.tag.Equals("tut_click"))
        {
            manager.TutClick();
        }
        else if (col.tag.Equals("tut_unclick"))
        {
            manager.TutUnclick();
        }
    }