Example #1
0
    public void Shoot(SpheroWeaponType type, float direction)
    {
        //Get the ProjectileControl object associated with the shooting player
        String            playerName       = DeviceName.ToLower().Contains("boo") ? "player1" : "player2";
        ProjectileControl playerProjectile = GameObject.Find(playerName).GetComponent <ProjectileControl>();

        //Put the direction into the correct range
        direction += (float)Math.PI;

        //Covert the direction into a vector
        Vector3 directionVector = new Vector3((float)Math.Cos(direction), (float)Math.Sin(direction), 0.0f);

        //Tell the sphero to shoot
        playerProjectile.Shoot(directionVector);
    }