Ejemplo n.º 1
0
    public void LaunchThorpede(MissleSide side, Object beh)
    {
        if (side == MissleSide.FRIENDLY)
        {
            friendlyInstance = (FriendlySpaceship)beh;
            misTmp           = getFreeThorpede(side);

            misTmp.gameObject.transform.position    = friendlyInstance.MisslesLaunchPoint.transform.position;
            misTmp.gameObject.transform.eulerAngles = new Vector3(270, friendlyInstance.transform.eulerAngles.y, 0);
            misTmp.Activate();
            misTmp.hideIcon();
            misTmp.gameObject.SetActive(true);
            activeFriendlyThorpedes.Add(misTmp);
        }
        if (side == MissleSide.ENEMY)
        {
            enemyInstance = (EnemySpaceship)beh;
            misTmp        = getFreeThorpede(side);
            misTmp.gameObject.transform.position    = enemyInstance.MissleLaunchPos.transform.position;
            misTmp.gameObject.transform.eulerAngles = new Vector3(270, enemyInstance.transform.eulerAngles.y, 0);
            misTmp.Activate();
            misTmp.gameObject.SetActive(true);
            activeEnemyThorpeds.Add(misTmp);
        }
    }
Ejemplo n.º 2
0
    public FriendlySpaceship getNearbyFriendly(MissleBehaviour attacker)
    {
        FriendlySpaceship ret = null;

        d = -1;
        v1.Set(attacker.gameObject.transform.position.x, attacker.gameObject.transform.position.z);
        foreach (FriendlySpaceship target in friendlySpaceships)
        {
            v2.Set(target.gameObject.transform.position.x, target.gameObject.transform.position.z);
            if (d < 0)
            {
                ret = target;
                v2.Set(v1.x - v2.x, v1.y - v2.y);
                d = v2.sqrMagnitude;
            }
            else
            {
                v2.Set(v1.x - v2.x, v1.y - v2.y);
                if (d > v2.sqrMagnitude)
                {
                    ret = target;
                    d   = v2.sqrMagnitude;
                }
            }
        }
        return(ret);
    }
Ejemplo n.º 3
0
 public void toggleShowAllAttackIcons(MissleBehaviour exclude)
 {
     foreach (FriendlySpaceship obj in friendlySpaceships)
     {
         obj.showAttackIcon();
     }
     MisslePoolManager.getInstance().ToggleShowAllAttackIcons(exclude);
 }
Ejemplo n.º 4
0
 public void MarkToRemoveStaticMissle(MissleBehaviour mis)
 {
     if (mis.type == MissleType.GAS)
     {
         if (mis.side == MissleSide.ENEMY)
         {
             enemyGasRemoveList.Add(mis);
         }
         if (mis.side == MissleSide.FRIENDLY)
         {
             friendlyGasRemoveList.Add(mis);
         }
     }
 }
Ejemplo n.º 5
0
 public void DestroyGas(MissleBehaviour mis)
 {
     if (mis.side == MissleSide.ENEMY)
     {
         activeEnemyGasList.Remove(mis);
     }
     else if (mis.side == MissleSide.FRIENDLY)
     {
         activeFriendlyGasList.Remove(mis);
     }
     //mis.gameObject.transform.position=stackPos;
     mis.gameObject.SetActive(false);
     bringToBack(mis);
 }
Ejemplo n.º 6
0
 private void bringToBack(MissleBehaviour missle)
 {
     if (missle.type == MissleType.ROCKET)
     {
         if (missle.side == MissleSide.FRIENDLY)
         {
             friendlyRockets.Add(missle);
         }
         if (missle.side == MissleSide.ENEMY)
         {
             enemyRockets.Add(missle);
         }
     }
     if (missle.type == MissleType.THORPEDE)
     {
         if (missle.side == MissleSide.FRIENDLY)
         {
             friendlyThorpeds.Add(missle);
         }
         if (missle.side == MissleSide.ENEMY)
         {
             enemyThorpeds.Add(missle);
         }
     }
     if (missle.type == MissleType.GAS)
     {
         if (missle.side == MissleSide.FRIENDLY)
         {
             friendlyGasList.Add(missle);
         }
         if (missle.side == MissleSide.ENEMY)
         {
             enemyGasList.Add(missle);
         }
     }
     if (missle.type == MissleType.MINES)
     {
         if (missle.side == MissleSide.FRIENDLY)
         {
             friendlyMinesList.Add(missle);
         }
         if (missle.side == MissleSide.ENEMY)
         {
             enemyMinesList.Add(missle);
         }
     }
 }
Ejemplo n.º 7
0
 public void ToggleShowAllAttackIcons(MissleBehaviour exclude)
 {
     foreach (MissleBehaviour obj in activeFriendlyRockets)
     {
         if (obj != exclude)
         {
             obj.showIcon();
         }
     }
     foreach (MissleBehaviour obj in activeFriendlyThorpedes)
     {
         if (obj != exclude)
         {
             obj.showIcon();
         }
     }
     //THORPEDS
 }
Ejemplo n.º 8
0
 public void LaunchGas(MissleSide side, Object beh)
 {
     if (side == MissleSide.FRIENDLY)
     {
         friendlyInstance = (FriendlySpaceship)beh;
         misTmp           = getFreeGas(side);
         misTmp.gameObject.transform.position    = friendlyInstance.transform.position;
         misTmp.gameObject.transform.eulerAngles = new Vector3(270, friendlyInstance.transform.eulerAngles.y, 0);
         misTmp.Activate();
         misTmp.gameObject.SetActive(true);
         activeFriendlyGasList.Add(misTmp);
     }
     if (side == MissleSide.ENEMY)
     {
         enemyInstance = (EnemySpaceship)beh;
         misTmp        = getFreeGas(side);
         misTmp.gameObject.transform.position    = enemyInstance.transform.position;
         misTmp.gameObject.transform.eulerAngles = new Vector3(270, enemyInstance.transform.eulerAngles.y, 0);
         misTmp.Activate();
         misTmp.gameObject.SetActive(true);
         activeEnemyGasList.Add(misTmp);
     }
 }
Ejemplo n.º 9
0
 private MissleBehaviour getFreeThorpede(MissleSide side)
 {
     if (side == MissleSide.FRIENDLY)
     {
         foreach (MissleBehaviour missle in friendlyThorpeds)
         {
             misTmp = missle;
             break;
         }
         friendlyThorpeds.Remove(misTmp);
         return(misTmp);
     }
     if (side == MissleSide.ENEMY)
     {
         foreach (MissleBehaviour missle in enemyThorpeds)
         {
             misTmp = missle;
             break;
         }
         enemyThorpeds.Remove(misTmp);
         return(misTmp);
     }
     return(null);
 }
Ejemplo n.º 10
0
	public void toggleShowAllAttackIcons(MissleBehaviour exclude)
	{
		foreach(FriendlySpaceship obj in friendlySpaceships)
			obj.showAttackIcon();
		MisslePoolManager.getInstance().ToggleShowAllAttackIcons(exclude);
	}
Ejemplo n.º 11
0
	public void DestroyGas(MissleBehaviour mis)
	{
		if(mis.side==MissleSide.ENEMY)
			activeEnemyGasList.Remove(mis);
		else if(mis.side==MissleSide.FRIENDLY)
			activeFriendlyGasList.Remove(mis);
		//mis.gameObject.transform.position=stackPos;
		mis.gameObject.SetActive(false);
		bringToBack(mis);
	}
Ejemplo n.º 12
0
	public void MarkToRemoveStaticMissle(MissleBehaviour mis)
	{
		if(mis.type==MissleType.GAS)
		{
			if(mis.side==MissleSide.ENEMY)
				enemyGasRemoveList.Add(mis);
			if(mis.side==MissleSide.FRIENDLY)
				friendlyGasRemoveList.Add(mis);
		}
	}
Ejemplo n.º 13
0
	public void LaunchMine(MissleSide side, Object beh)
	{
		if(side==MissleSide.FRIENDLY)
		{
			friendlyInstance=(FriendlySpaceship) beh;
			misTmp=getFreeMine(side);
			misTmp.gameObject.transform.position=friendlyInstance.transform.position;
			misTmp.gameObject.transform.eulerAngles=new Vector3(270,friendlyInstance.transform.eulerAngles.y,0);
			misTmp.Activate();
			misTmp.gameObject.SetActive(true);
			activeFriendlyMinesList.Add(misTmp);
		}
		if(side==MissleSide.ENEMY)
		{
			enemyInstance=(EnemySpaceship) beh;
			misTmp=getFreeMine(side);
			misTmp.gameObject.transform.position=enemyInstance.transform.position;
			misTmp.gameObject.transform.eulerAngles=new Vector3(270,enemyInstance.transform.eulerAngles.y,0);
			misTmp.Activate();
			misTmp.gameObject.SetActive(true);
			activeEnemyMinesList.Add(misTmp);
		}
	}
Ejemplo n.º 14
0
	private MissleBehaviour getFreeThorpede(MissleSide side)
	{
		if(side==MissleSide.FRIENDLY)
		{
			foreach(MissleBehaviour missle in friendlyThorpeds)
			{
				misTmp=missle;
				break;
			}
			friendlyThorpeds.Remove(misTmp);
			return misTmp;
		}
		if(side==MissleSide.ENEMY)
		{
			foreach(MissleBehaviour missle in enemyThorpeds)
			{
				misTmp=missle;
				break;
			}
			enemyThorpeds.Remove(misTmp);
			return misTmp;
		}
		return null;
	}
Ejemplo n.º 15
0
	private void bringToBack(MissleBehaviour missle)
	{
		if(missle.type==MissleType.ROCKET)
		{
			if(missle.side==MissleSide.FRIENDLY)
				friendlyRockets.Add(missle);
			if(missle.side==MissleSide.ENEMY)
				enemyRockets.Add(missle);
		}
		if(missle.type==MissleType.THORPEDE)
		{
			if(missle.side==MissleSide.FRIENDLY)
				friendlyThorpeds.Add(missle);
			if(missle.side==MissleSide.ENEMY)
				enemyThorpeds.Add(missle);
		}
		if(missle.type==MissleType.GAS)
		{
			if(missle.side==MissleSide.FRIENDLY)
				friendlyGasList.Add(missle);
			if(missle.side==MissleSide.ENEMY)
				enemyGasList.Add(missle);
		}
		if(missle.type==MissleType.MINES)
		{
			if(missle.side==MissleSide.FRIENDLY)
				friendlyMinesList.Add(missle);
			if(missle.side==MissleSide.ENEMY)
				enemyMinesList.Add(missle);
		}
	}
Ejemplo n.º 16
0
	public void ToggleShowAllAttackIcons(MissleBehaviour exclude)
	{
		foreach(MissleBehaviour obj in activeFriendlyRockets)
			if(obj!=exclude)
				obj.showIcon();
		foreach(MissleBehaviour obj in activeFriendlyThorpedes)
			if(obj!=exclude)
				obj.showIcon();
		//THORPEDS
	}
Ejemplo n.º 17
0
	public FriendlySpaceship getNearbyFriendly(MissleBehaviour attacker)
	{
		FriendlySpaceship ret=null;
		d=-1;
		v1.Set(attacker.gameObject.transform.position.x,attacker.gameObject.transform.position.z);
		foreach(FriendlySpaceship target in friendlySpaceships)
		{
			v2.Set(target.gameObject.transform.position.x,target.gameObject.transform.position.z);
			if(d<0)
			{
				ret=target;
				v2.Set(v1.x-v2.x,v1.y-v2.y);
				d = v2.sqrMagnitude;
			}
			else
			{
				v2.Set(v1.x-v2.x,v1.y-v2.y);
				if(d>v2.sqrMagnitude)
				{
					ret=target;
					d=v2.sqrMagnitude;
				}
			}
		}
		return ret;
	}