Exemple #1
0
    void Player2()
    {
        SpeedX = Input.GetAxis("Player2LR") * standardSpeed;

        /*The velocity on the x-axis is multiplication
         * of the return of the horizontal get axis method and the standard velocity*/
        SpeedY = Input.GetAxis("PlayerDU") * standardSpeed;

        /* The velocity on the Y-axis is multiplication
         * of the return of the Vertival get axis method and the standard velocity*/
        this.gameObject.GetComponent <Rigidbody2D>().velocity = new Vector2(SpeedX, SpeedY);
        //This method set the velocity(velocity of the Componet Rigidbody2D) to the two velocitys (Speed x, Speed Y)
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            BulletWayOnWalking = BulletWay.Up;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            BulletWayOnWalking = BulletWay.Down;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            BulletWayOnWalking = BulletWay.Left;
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            BulletWayOnWalking = BulletWay.Rigth;
        }
        else if (Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.DownArrow) || Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow))
        {
            BulletWayOnWalking = BulletWay.Down;
        }
    }
Exemple #2
0
    //---------------------------------------------------------------------------------------------------------------------
    //Bullet Paths - Methods
    //---------------------------------------------------------------------------------------------------------------------

    public int addBulletForId(Vector3 pos, int playerId)
    {
        BulletWay newBullet = new BulletWay(pos, bulletIdentifier++, playerId);

        bulletFlights.Add(newBullet);
        return(newBullet.id);
    }
Exemple #3
0
    public void updateBulletPath(Vector3 pos, int id)
    {
        BulletWay bullet = getBulletById(id);

        bullet.distance += Vector3.Distance(bullet.lastPos, pos);
        bullet.lastPos   = pos;
        bullet.hits++;
    }
Exemple #4
0
    public void killBullet(int id)
    {
        BulletWay bullet = getBulletById(id);

        if (bullet.distance > longestShotDistance.points)
        {
            longestShotDistance.playerId = bullet.getPlayerId();
            longestShotDistance.points   = bullet.distance;
        }
        bulletFlights.Remove(bullet);
    }
Exemple #5
0
 void Start()
 {
     Player1 = GameObject.FindGameObjectWithTag("Player 1");
     Player2 = GameObject.FindGameObjectWithTag("Player 2");
     Bullet  = GameObject.FindGameObjectWithTag("Bullet");
     if (WhoIsThePlayerWhoThrew == Player.Player1)
     {
         BulletWaySide = Player1.GetComponent <CharacterMovimentControler>().BulletWayOnWalking;
     }
     else if (WhoIsThePlayerWhoThrew == Player.Player2)
     {
         BulletWaySide = Player2.GetComponent <CharacterMovimentControler>().BulletWayOnWalking;
     }
 }
Exemple #6
0
 public void SayBulletWay(BulletWay BulletWaySide)
 {
     BulletWaySide = BulletWayOnWalking;
 }