Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.name.Equals("Player1"))
        {
            GameObject player1 = GameObject.Find("Player1");
            if (player1 != null)
            {
                PlayerScript playerScript = player1.GetComponent <PlayerScript> ();
                playerScript.stuck = true;
            }
            //Destroy (gameObject);
        }

        if (other.gameObject.name.Equals("Player2"))
        {
            GameObject player2 = GameObject.Find("Player2");
            if (player2 != null)
            {
                Player2Script player2Script = player2.GetComponent <Player2Script> ();
                player2Script.stuck = true;
            }
            //Destroy (gameObject);
        }

        if (other.gameObject.name.Equals("Player3"))
        {
        }

        if (other.gameObject.name.Equals("Player4"))
        {
        }
    }
Exemplo n.º 2
0
    IEnumerator DestroyPlayer2(GameObject a)
    {
        yield return(new WaitForSeconds(0.2f));

        Player2Script player2Script = a.GetComponent <Player2Script> ();

        if ((canKillP2) && (player2Script.player2Attacking == false))
        {
            Destroy(GameObject.Find("Player2"));
            canKillP2 = false;
        }
        if ((canKillP2) && (player2Script.player2Attacking == true))
        {
            if (facingRight)
            {
                a.GetComponent <Rigidbody2D> ().AddForce(new Vector2(200f, 0.0f));
                rigidBody2D.AddForce(new Vector2(-400f, 0.0f));
            }
            if (!facingRight)
            {
                a.GetComponent <Rigidbody2D> ().AddForce(new Vector2(-200f, 0.0f));
                rigidBody2D.AddForce(new Vector2(400f, 0.0f));
            }
        }
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        GameObject gameData = GameObject.Find("GameData");

        if (gameData != null)
        {
            GameDataScript gameDataScript = gameData.GetComponent <GameDataScript> ();
            GameObject     player1        = GameObject.Find("Player1");
            if (player1 != null)
            {
                PlayerScript playerScript = player1.GetComponent <PlayerScript> ();
                if (playerScript.p1Throw == true)
                {
                    GetComponent <Rigidbody2D> ().AddForce(new Vector2(gameDataScript.p1riceSpeed, 0.0f));
                    playerScript.p1Throw = false;
                }
            }
            GameObject player2 = GameObject.Find("Player2");
            if (player2 != null)
            {
                Player2Script player2Script = player2.GetComponent <Player2Script> ();
                if (player2Script.p2Throw == true)
                {
                    GetComponent <Rigidbody2D> ().AddForce(new Vector2(gameDataScript.p2riceSpeed, 0.0f));
                    player2Script.p2Throw = false;
                }
            }
        }
        StartCoroutine(BulletDelayedDestroy());
    }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     //player = GameObject.FindGameObjectWithTag("Hero2").transform;
     player   = GameObject.Find("Player 2").transform;
     m_player = player.GetComponent <Player2Script>();
     //arrowUp = false;
 }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        switch (battleState)
        {
        case (PerformAction.wait):
            if (PerformList.Count > 0)
            {
                battleState = PerformAction.takeAction;
            }
            break;

        case (PerformAction.takeAction):
            GameObject performer = GameObject.Find(PerformList[0].Attacker);
            if (PerformList[0].Type == "Player2")
            {
                Player2Script plyr2 = performer.GetComponent <Player2Script>();
                plyr2.targetEnemy  = PerformList[0].AttackersTarget;
                plyr2.currentState = Player2Script.Turnstate.action;
            }
            if (PerformList[0].Type == "Player")
            {
                Player1Script plyr = performer.GetComponent <Player1Script>();
                plyr.targetEnemy  = PerformList[0].AttackersTarget;
                plyr.currentState = Player1Script.Turnstate.action;
            }
            break;

        case (PerformAction.performAction):

            break;
        }

        battleState = PerformAction.performAction;
    }
    void Start()
    {
        GameObject go = GameObject.Find("HealthBar");

        p2Health = go.GetComponent <HealthSystem>();

        GameObject p1 = GameObject.Find("HealthBarP1");

        p1Health = p1.GetComponent <HealthSystem>();

        p1Health.SetMaxHealth(100);
        p2Health.SetMaxHealth(100);

        GameObject p = GameObject.Find("Player");

        player1 = p.GetComponent <PlayerMovement>();

        GameObject p2 = GameObject.Find("Player2");

        player2 = p2.GetComponent <Player2Script>();

        colliders = new BoxCollider2D[] { frame };

        GameObject sound = GameObject.Find("Punch");

        punch = sound.GetComponent <AudioSource>();
    }
Exemplo n.º 7
0
 void Start()
 {
     upgrade = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerScript>();
     if (Application.loadedLevel == 8 || Application.loadedLevel > 9)
     {
         upgrade2 = GameObject.FindGameObjectWithTag("Player2").GetComponent <Player2Script>();
     }
 }
Exemplo n.º 8
0
    void Start()
    {
        if (Application.loadedLevel != 0 && Application.loadedLevel != 2)
        {
            ps = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerScript>();
            if (Application.loadedLevel > 7 && Application.loadedLevel != 9)
            {
                ps2 = GameObject.FindGameObjectWithTag("Player2").GetComponent <Player2Script>();
            }
        }


        if (Application.loadedLevel != 2)
        {
            switchS = false;
        }

        f = GameObject.FindGameObjectWithTag("Fade").GetComponent <Fade1>();


        if (PlayerPrefs.HasKey("HighscoreSurvival"))
        {
            highScoreSurvival = PlayerPrefs.GetInt("HighscoreSurvival");
        }


        if (PlayerPrefs.HasKey("Score"))
        {
            if (Application.loadedLevel == 0)
            {
                PlayerPrefs.DeleteKey("Score");
                score = 0;
            }
            else
            {
                score = PlayerPrefs.GetInt("Score");
            }
        }

        if (PlayerPrefs.HasKey("Score2"))
        {
            if (Application.loadedLevel == 0)
            {
                PlayerPrefs.DeleteKey("Score2");
                score2 = 0;
            }
            else
            {
                score2 = PlayerPrefs.GetInt("Score2");
            }
        }

        if (PlayerPrefs.HasKey("Highscore"))
        {
            highScore = PlayerPrefs.GetInt("Highscore");
        }
    }
Exemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     player1       = GameObject.FindWithTag("Player");
     player2       = GameObject.FindWithTag("Player2");
     player1Script = player1.GetComponent <Player1Script>();
     player2Script = player2.GetComponent <Player2Script>();
     Glower        = this.gameObject.GetComponent <ParticleSystem>();
     Glower.Stop();
 }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        battleState = PerformAction.wait;
        Player1     = GameObject.FindGameObjectWithTag("Player").GetComponent <Player1Script>();
        Player2     = GameObject.FindGameObjectWithTag("Player2").GetComponent <Player2Script>();


        P1.Add(GameObject.FindGameObjectWithTag("Player"));
        P2.Add(GameObject.FindGameObjectWithTag("Player2"));
    }
Exemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        wordCheck = GameObject.FindGameObjectWithTag("P1Manager").GetComponent <ScrambleWord>();

        StatesUp.gameObject.SetActive(false);
        player2       = GameObject.FindGameObjectWithTag("Player2").GetComponent <Player2Script>();
        StartPosition = new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y, this.gameObject.transform.position.z);
        animPlayer1   = GameObject.FindGameObjectWithTag("Player").gameObject.GetComponent <Animator>();
        targetEnemy   = GameObject.FindGameObjectWithTag("Player2");
        bsm           = GameObject.FindGameObjectWithTag("BSM").GetComponent <BattleStateMachine>();
        currentState  = Turnstate.processing;
    }
Exemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        player1 = GameObject.FindGameObjectWithTag("Player").GetComponent <Player1Script>();
        player2 = GameObject.FindGameObjectWithTag("Player2").GetComponent <Player2Script>();
        int startingWord = Random.Range(4, words.Length);

        currentWord = startingWord;
        int indexChar = Random.Range(0, words.Length - 1);

        //txtChoices.text = words[indexChar].ToString ();
        showScrambleLetters(currentWord);
    }
Exemplo n.º 13
0
    private void OnTriggerEnter2D(Collider2D hitInfo)
    {
        Debug.Log(hitInfo.name);
        Player2Script p2 = hitInfo.GetComponent <Player2Script>();

        if (p2 != null)
        {
            p2.TakesDamage2(damage1);
            Destroy(gameObject);
        }
        else if (hitInfo.name == "Background")
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 14
0
 private void Awake()
 {
     current = this;
 }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     player1 = GameObject.FindGameObjectWithTag("Player").GetComponent <Player1Script>();
     player2 = GameObject.FindGameObjectWithTag("Player").GetComponent <Player2Script>();
 }