コード例 #1
0
 // Use this for initialization
 void Start()
 {
     //Set variables
     doorPos = door.transform.position;
     player1 = FindObjectOfType <Player1Movement> ();
     player2 = FindObjectOfType <Player2Movement> ();
 }
コード例 #2
0
 void Start()
 {
     anim             = GetComponent <Animator> ();
     move             = GetComponent <Player1Movement> ();
     fireTime         = Time.time;
     arrowPower.value = 0;
 }
コード例 #3
0
    IEnumerator EndGame(int seconds)
    {
        yield return(new WaitForSeconds(seconds));

        gObjects = GameObject.FindGameObjectsWithTag("Wall");
        for (int i = 0; i < gObjects.Length; i++)
        {
            Destroy(gObjects [i]);
        }
        pObjects = GameObject.FindGameObjectsWithTag("Player");
        for (int i = 0; i < pObjects.Length; i++)
        {
            Destroy(pObjects [i]);
        }
        GameObject      PlayerOne = GameObject.Find("Player1");
        Player1Movement script1   = PlayerOne.GetComponent <Player1Movement> ();
        GameObject      PlayerTwo = GameObject.Find("Player2");
        Player2Movement script2   = PlayerTwo.GetComponent <Player2Movement> ();

        score1 = script1.score;
        score2 = script2.score;
        if (score1 > score2)
        {
            EndMessage.text = "Player One won the game by " + (score1 - score2).ToString() + " points!";
        }
        if (score2 > score1)
        {
            EndMessage.text = "Player Two won the game by " + (score2 - score1).ToString() + " points!";
        }
    }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     //Set variables
     player1 = FindObjectOfType <Player1Movement> ();
     player2 = FindObjectOfType <Player2Movement> ();
     rigid1  = player1.GetComponent <Rigidbody> ();
     rigid2  = player2.GetComponent <Rigidbody> ();
 }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     //Finds the players
     Player1 = FindObjectOfType <Player1Movement> ();
     Player2 = FindObjectOfType <Player2Movement> ();
     rigid1  = Player1.GetComponent <Rigidbody> ();
     rigid2  = Player2.GetComponent <Rigidbody> ();
 }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     //Set variables
     player1           = FindObjectOfType <Player1Movement> ();
     player2           = FindObjectOfType <Player2Movement> ();
     rigid1            = player1.GetComponent <Rigidbody> ();
     rigid2            = player2.GetComponent <Rigidbody> ();
     player1GameObject = player1.gameObject;
     player2GameObject = player2.gameObject;
     isThrowable       = false;
 }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        currentHealth = maxHealth;

        currentShieldHealth = maxShieldHealth;
        shieldSize          = shield.transform.localScale;

        anim = GetComponent <Animator> ();
        rb   = GetComponent <Rigidbody2D> ();
        move = GetComponent <Player1Movement> ();
    }
コード例 #8
0
ファイル: GameManager.cs プロジェクト: caiovini980/OctaPong
    void SetupGame()
    {
        _p1Movement = GameObject.Find(_PLAYER_1_NAME).GetComponent <Player1Movement>();
        _p2Movement = GameObject.Find(_PLAYER_2_NAME).GetComponent <Player2Movement>();

        _p1Shoot = GameObject.Find(_PLAYER_1_AIM).GetComponent <Player1Shoot>();
        _p2Shoot = GameObject.Find(_PLAYER_2_AIM).GetComponent <Player2Shoot>();

        _p1Health = GameObject.Find(_PLAYER_1_NAME).GetComponent <PlayerHealth>();
        _p2Health = GameObject.Find(_PLAYER_2_NAME).GetComponent <PlayerHealth>();


        state = BattleState.PLAYER1_TURN;
        Player1Turn();
    }
コード例 #9
0
        public WeakBaloon(bool isPlayer1Baloon)
        {
            Speed           = 3;
            Damage          = 1;
            IsPlayer1Baloon = isPlayer1Baloon;
            type            = Helpers.Enums.BaloonTypes.Weak;
            SpacingPoint    = new PointF(50, 50);

            if (isPlayer1Baloon)
            {
                moveStrategy = new Player1Movement();
            }
            else
            {
                moveStrategy = new Player2Movement();
                Position.X   = 675;
            }
        }
コード例 #10
0
        public IntermediateBaloon(bool isPlayer1Baloon)
        {
            Speed           = 5;
            Damage          = 20;
            IsPlayer1Baloon = isPlayer1Baloon;
            type            = Helpers.Enums.BaloonTypes.Intermediate;
            SpacingPoint    = new PointF(70, 70);

            if (isPlayer1Baloon)
            {
                moveStrategy = new Player1Movement();
            }
            else
            {
                moveStrategy = new Player2Movement();
                Position.X   = 675;
            }
        }
コード例 #11
0
        public PowerfulBaloon(bool isPlayer1Baloon)
        {
            Speed           = 7;
            Damage          = 10;
            type            = Helpers.Enums.BaloonTypes.Powerful;
            IsPlayer1Baloon = isPlayer1Baloon;
            SpacingPoint    = new PointF(100, 100);

            if (isPlayer1Baloon)
            {
                moveStrategy = new Player1Movement();
            }
            else
            {
                moveStrategy = new Player2Movement();
                Position.X   = 675;
            }
        }
コード例 #12
0
    void OnCollisionEnter2D(Collision2D other)
    {
        GameObject      PlayerOne      = GameObject.Find("Player1");
        Player1Movement script         = PlayerOne.GetComponent <Player1Movement> ();
        GameObject      explode        = (GameObject)Instantiate(Resources.Load("Explode"), gameObject.transform.position, gameObject.transform.rotation);
        GameObject      explodingSound = (GameObject)Instantiate(Resources.Load("ExplodingSound"), gameObject.transform.position, gameObject.transform.rotation);

        Destroy(gameObject);
        Destroy(explode, 3f);
        Destroy(explodingSound, 3f);

        if (other.gameObject.tag == "Player")
        {
            script.score += 3;
        }
        if (other.gameObject.name.Contains("Enemy"))
        {
            Debug.Log("destroying enemy");
            script.score += 1;
        }
    }
コード例 #13
0
 void Awake()
 {
     p1Movement = GetComponent <Player1Movement>();
 }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     player = GetComponentInParent <Player1Movement> ();
 }
コード例 #15
0
 // Start is called before the first frame update
 void Start()
 {
     scrollingTerrain = FindObjectOfType <ScrollingTerrain>();
     audioSource      = GetComponent <AudioSource>();
     player1Movement  = GetComponent <Player1Movement>();
 }