void Awake()
 {
     buttonPress = GameObject.Find("ButtonPress").GetComponent<AudioSource>();
     platform = GetComponent<FloatingPlatform>();
     if (!platform)
         Debug.LogError("cannot find platform for campaignplatform!");
 }
Exemplo n.º 2
0
    private void OnEnable()
    {
        if (!target)
        {
            return;
        }
        platform = (FloatingPlatform)target;
        collider = platform.GetComponent <BoxCollider>();

        platform.MakeWaypointsArraySafe();
        platform.waypoints[0].position = platform.transform.position;
    }
Exemplo n.º 3
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        //Plays audio on collision with objects tagged as Atom
        if (collision.gameObject.CompareTag("Atom"))
        {
            audioClips.AtomGet();
            uI.AddAtom();
            uI.AddToScore(100);
        }

        if (collision.gameObject.CompareTag("FloatingPlatformCollision"))
        {
            floatingPlatform = collision.gameObject.GetComponent <FloatingPlatform>();
            isOnPlatform     = true;
        }

        if (collision.gameObject.CompareTag("Robot") ||
            collision.gameObject.CompareTag("HatchMonster") ||
            collision.gameObject.CompareTag("SmallEnemy"))
        {
            notDead = false;


            if (walkingDirection)
            {
                myAnimator.CrossFade("ElectrocutionRight", 0.0f);
            }
            else
            {
                myAnimator.CrossFade("ElectrocutionLeft", 0.0f);
            }

            audioClips.Electrocution();

            rigidbody2D.velocity = jumpPos;

            transform.collider2D.isTrigger = true;
        }
    }
 // Use this for initialization
 void Start()
 {
     _player   = GetComponent <Player>();
     _platform = GameObject.FindGameObjectWithTag("Platform").GetComponent <FloatingPlatform>();
 }