Example #1
0
    public override void SendMouse1Order(RTSGameObject target, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (target.GetComponent <Unit>())
            {
                if (target.faction == Faction.Neutral)
                {
                    Debug.Log("Can't attack this target");
                }

                else if (target.faction != this.faction)
                {
                    SendMessage("StopAction"); // Interrupt any other actions
                    AttackScript.Attack(target);
                }
            }
            else if (target.GetComponent <Collectable>()) // Goldmine, wood
            {
                MoveScript.Move(target.transform.position);
            }

            else if (target.GetComponent <CollectableObject>()) // Collectable object
            {
                // Take the Object
            }
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Mouse1, Vector3.zero, target));
        }
    }
Example #2
0
    //



    /// /////////////////////////////////////////////////////

    protected virtual void Start()
    {
        if (values == null)
        {
            Debug.LogError("No enemy values could be found");
        }

        GameObject go = GameObject.Find("Player Normal");

        if (go != null)
        {
            nPlayer = go.transform;
        }
        go = GameObject.Find("Player Spirit");
        if (go != null)
        {
            sPlayer = go.transform;
        }

        thisTransform = GetComponent <Transform>();
        rigidBody     = GetComponent <Rigidbody2D>();
        attack        = GetComponent <AttackScript>();

        animInfo = new AnimationInformation();

        waitTime         = 0;
        startPosition    = thisTransform.position;
        currentWaitState = WaitStates.MOVE;
    }
Example #3
0
    /// /////////////////////////////////////////////////////

    protected virtual void Start()
    {
        if (values == null)
        {
            Debug.LogError("No enemy values could be found");
        }

        GameObject go = GameObject.Find("Player Android");

        if (go != null)
        {
            aPlayer = go.transform;
        }
        go = GameObject.Find("Player Soldier");
        if (go != null)
        {
            sPlayer = go.transform;
        }

        attack = GetComponent <AttackScript>();

        animInfo = new AnimationInformation();

        waitTime         = 0;
        firstTime        = true;
        startPosition    = thisTransform.position;
        currentWaitState = WaitStates.MOVE;
        waitTimeLimits   = values.waitTimeLimits;
        moveSpeed        = values.speed.x;
    }
Example #4
0
    /// <summary>
    /// Creates an enemy for the spirit side of the battlefield.
    /// </summary>
    /// <param name="values"></param>
    /// <param name="group"></param>
    /// <param name="index"></param>
    private void CreateS(EnemyEntry values, EnemyGroup group)
    {
        if (!spawnTop)
        {
            return;
        }
        ggobjS = Instantiate(values.enemyModelS) as Transform;
        int side = Random.Range(0, 2);
        SStateController    state  = ggobjS.GetComponent <SStateController>();
        HurtableEnemyScript hurt   = ggobjS.GetComponent <HurtableEnemyScript>();
        AttackScript        attack = ggobjS.GetComponent <AttackScript>();

        if (side == 0)
        {
            state.leftSide = true;
        }

        ggobjS.position = state.GetRandomLocation();

        hurt.group = group;

        state.enemyid = enemyId;
        state.values  = ScriptableObject.CreateInstance <EnemyEntry>();
        state.values.CopyValues(values);

        group.top = hurt;
        group.sStateController = state;
        group.sTransform       = ggobjS;
        group.sAttackScript    = attack;
    }
 void Start()
 {
     // lerping variable initialization
     lerpTime          = 0;
     rateOfLerp        = 1.5f;
     disBeforeComplete = 0.25f;
     isLerping         = false;
     isLerpingForward  = false;
     // grabbing script
     pm        = GameObject.FindGameObjectWithTag("platforms").GetComponent <PlatformsMovement>();
     hs        = GameObject.FindGameObjectWithTag("health").GetComponent <HealthScript>();
     attScript = this.GetComponent <AttackScript>();
     // stance variables initialization
     isAllowedToMove          = true;
     stances                  = "";
     platforms                = new GameObject[6];
     playerPlatform           = new GameObject();
     removeIndex              = -1;
     removePlayerPlatformList = new List <GameObject>();
     // Value set to 100 so that accurate closest distance can be found
     distanceToNextPlatform = 100;
     nextPlatformDirection  = -1;
     // Possible update this to have a default normal non-special type attack
     // Subscribe to event calls
     Subscribe();
 }
Example #6
0
    public void SendAttackOrder(RTSGameObject target, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                Orders.Clear();
            }
            if (target.GetComponent <Unit>())
            {
                if (target.faction == Faction.Neutral)
                {
                    Debug.Log("Can't attack this target");
                }

                else if (target.faction != this.faction)
                {
                    SendMessage("StopAction"); // Interrupt any other actions
                    AttackScript.Attack(target);
                }
            }
            else if (target.GetComponent <Collectable>())
            {
            }
            else if (target.GetComponent <CollectableObject>())
            {
            }
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Attack, Vector3.zero, target));
        }
    }
    void ScanUnits2()
    {
        foreach (GameObject unit in mSecondObjList)
        {
            mMovement       = unit.GetComponent <MovementControlScript>();
            mBlobProperties = unit.GetComponent <BlobProperties>();
            mAttack         = unit.GetComponent <AttackScript>();

            //If the target is currently engaged, dont change their orders
            if (mAttack.GetEngage())
            {
                return;
            }

            //Something is in attack range. Fight it
            if (mBlobProperties.GetEnemyInRange().Count > 0)
            {
                foreach (GameObject obj in mBlobProperties.GetEnemyInRange())
                {
                    if (obj.GetComponent <BasicUnitScript>().GetOwnerID() != unit.GetComponent <BasicUnitScript>().GetOwnerID())
                    {
                        mAttack.SetAttackTarget(obj);
                        mMovement.AttackUnit(obj);
                        break;
                    }
                }
            }
            else
            {
                mAttack.SetEngage(false);
            }
        }
    }
 void Start()
 {
     rb            = GetComponent <Rigidbody2D>();
     boxCollider2D = GetComponent <BoxCollider2D>();
     animator      = GetComponent <Animator>();
     atkScr        = GetComponent <AttackScript>();
 }
Example #9
0
        public override void OnUpdate()
        {
            attackScript    = (AttackScript)GameObject.Find("WeaponAnimator").GetComponent(typeof(AttackScript));
            selectionScript = (SelectionScript)GameObject.Find("WeaponAnimator").GetComponent(typeof(SelectionScript));
            if (selectionScript.selectedweapon == 1 && (!semiAuto.Value && Input.GetKey(KeyCode.Mouse0)) || (semiAuto.Value && Input.GetKeyDown(KeyCode.Mouse0)))
            {
                switch (projectile.Selected)
                {
                case "BULLET":
                    attackScript.shootbullet(inaccuracy.GetValueFloat(), 1000f, shotNum.GetValueInt(), damage.GetValueFloat(), 1, speed.GetValueFloat(), upPower.GetValueFloat(), doricnoise.Value, ignoreTracers.Value, 1);
                    break;

                case "ARROW":
                    attackScript.throwprojectile(0, speed.GetValueFloat(), shotNum.GetValueFloat(), inaccuracy.GetValueFloat());
                    break;

                case "RIVET":
                    attackScript.throwprojectile(1, speed.GetValueFloat(), shotNum.GetValueFloat(), inaccuracy.GetValueFloat());
                    break;

                default:
                case "MORTAR":
                    attackScript.throwprojectile(2, speed.GetValueFloat(), shotNum.GetValueFloat(), inaccuracy.GetValueFloat());
                    break;
                }
            }
        }
    public override void Attack(StateController controller, AttackScript attackScript)
    {
        if (!(controller is SStateController))
        {
            Debug.LogError("Wrong controller user!");
            return;
        }

        Vector2    playerPos     = controller.sPlayer.position;
        var        shotTransform = Instantiate(attackScript.projectile) as Transform;
        Projectile projectile    = shotTransform.GetComponent <Projectile>();

        shotTransform.position = controller.thisTransform.position;
        MouseInformation info = new MouseInformation();

        info.position1 = controller.thisTransform.position;
        info.setPosition2(controller.sPlayer.position);
        if (setRotation)
        {
            shotTransform.localRotation = Quaternion.AngleAxis(info.rotationInternal, Vector3.forward);
        }

        projectile.isEnemy  = true;
        projectile.multiHit = attackScript.multihit;
        projectile.lifeTime = attackScript.lifeTime;
        projectile.SetDamage(attackScript.damage, 0, 1);
        projectile.SetMovement(attackScript.speed, info.rotationInternal);

        attackScript.bgui.effectList.Add(projectile);
    }
    void Update()
    {
        Player       player       = GameObject.FindWithTag("Player").GetComponent <Player>();
        Enemy        enemy        = GameObject.FindWithTag("Enemy").GetComponent <Enemy>();
        DiceScript   diceScript   = GameObject.FindWithTag("Dice").GetComponent <DiceScript>();
        AttackScript attackScript = GameObject.FindWithTag("CombatSystem").GetComponent <AttackScript>();

        if (state == CombatState.PLAYERROLL)
        {
            PlayerRollDice();
        }

        if (state == CombatState.PLAYERCOMBAT)
        {
            Debug.Log("I am in combat");
            MeleeAttackButton.SetActive(true);
            FireballAttackButton.SetActive(true);
        }
        else
        {
            MeleeAttackButton.SetActive(false);
            FireballAttackButton.SetActive(false);
        }

        if (state == CombatState.ENEMYTURN)
        {
            Debug.Log("Enemy is in combat");
            Invoke("EnemyRoll", 2f);
        }

        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }
    }
    /// <summary>
    /// Start is called before the first frame update
    /// </summary>
    void Start()
    {
        renderer = transform.Find("group1").GetComponent <Renderer>();
        if (!animator)
        {
            animator = GetComponent <Animator>();
        }
        spawnLocation = transform.position;
        if (!attackScript)
        {
            attackScript = GetComponent <AttackScript>();
        }
        originalMaxHealth = maxHealth;
        health            = maxHealth;

        if (!rigidbody)
        {
            rigidbody = GetComponent <Rigidbody>();
        }

        if (rigidbody != null)
        {
            rigidbody.isKinematic = true;
        }

        if (HealthPanel != null)
        {
            HealthPanel.transform.parent.gameObject.SetActive(gameObject.activeInHierarchy);
        }
    }
Example #13
0
 // find the player and associated scripts
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerScript = player.GetComponent <PlayerController>();
     atackScript  = player.GetComponent <AttackScript>();
     InvokeRepeating("AutoTarget", 1f, 0.1f);
 }
Example #14
0
 // Use this for initialization
 void Start()
 {
     startPos     = transform.position;
     myAction     = this.GetComponent <AttackScript>();
     currentState = TurnState.PROCESSING;
     battle       = GameObject.Find("BattleManager(Clone)").GetComponent <BattleStateMachine>();
     this.GetComponent <CameraFacingBillboard>();
 }
Example #15
0
 void Start()
 {
     col       = GetComponent <EdgeCollider2D>();
     atk       = GetComponent <AttackScript>();
     trail     = GetComponent <TrailRenderer>();
     prevPos   = transform.position;
     formerPos = transform.position;
 }
Example #16
0
	// Use this for initialization
	void Start () {
		render = GetComponent<Renderer> ();
		heightToCenter = GetComponent<CapsuleCollider> ().height / 2;
		currentlyMoving = false;
		
		targetLocation = startLocation = transform.position;
        attackScript = GetComponent<AttackScript>();
	}
 // Use this for initialization
 void Start()
 {
     playerControl = transform.root.GetComponent <CharacterController2D>();
     playerHealth  = transform.root.GetComponent <PlayerHealthManager>();
     shoot         = transform.GetComponentInChildren <FireBullet>();
     attack        = transform.GetComponentInChildren <AttackScript>();
     chargeAttack  = transform.GetComponentInChildren <PlayerChargeMelee>();
     element       = transform.root.GetComponent <ElementSystem>();
 }
Example #18
0
    // Use this for initialization
    void Start()
    {
        render          = GetComponent <Renderer> ();
        heightToCenter  = GetComponent <CapsuleCollider> ().height / 2;
        currentlyMoving = false;

        targetLocation = startLocation = transform.position;
        attackScript   = GetComponent <AttackScript>();
    }
 private void Start()
 {
     rend = GetComponent<SpriteRenderer>();
     enemyDmg = GetComponent<EnemyDamageScript>();
     enemyMovement = GetComponent<Enemymovement>();
     attack = GetComponent<AttackScript>();
     boxCollider = GetComponent<Collider2D>();
     sprite = GetComponent<SpriteRenderer>();
 }
Example #20
0
 // Use this for initialization
 void Start()
 {
     arrayOfStanceGameObjects[0] = leftStance; arrayOfStanceGameObjects[1] = midStance; arrayOfStanceGameObjects[2] = rightStance;
     player     = GameObject.FindGameObjectWithTag("Player");
     movScript  = player.GetComponent <MovementScript>();
     attScript  = player.GetComponent <AttackScript>();
     healScript = GameObject.FindGameObjectWithTag("health").GetComponent <HealthScript>();
     Subscribe();
 }
Example #21
0
 // Use this for initialization
 void Awake()
 {
     manager         = GameObject.Find("GameManager").GetComponent <GameManager>();
     mainCamera      = GameObject.Find("Main Camera");
     secondaryCamera = GameObject.Find("Secondary Camera");
     secondaryCamera.SetActive(false);
     fill   = GameObject.Find("HandManager").GetComponent <FillHand>();
     attack = GameObject.Find("GameBoard").GetComponent <AttackScript>();
     golds  = GameObject.Find("GoldManager").GetComponent <GoldScript>();
 }
 public void attackUpdate(AttackScript givAtkScript, AttackSystem givAttackSystem)
 {
     if (Time.time > nextAttack)
     {
         attackSprite.transform.localScale = new Vector3(-attackSprite.transform.localScale.x, attackSprite.transform.localScale.y, attackSprite.transform.localScale.z);
         nextAttack = Time.time + givAttackSystem.attackRate;
         attackSprite.SetActive(true);
         StartCoroutine(attackUpdateVisuals(givAtkScript));
     }
 }
    bool hasAttackScript(GameObject givenNPC)
    {
        bool         result = false;
        AttackScript script = givenNPC.GetComponent <AttackScript> ();

        if (script != null)
        {
            result = true;
        }
        return(result);
    }
    public override void Attack(StateController controller, AttackScript attackScript)
    {
        if (!(controller is AStateController))
        {
            Debug.LogError("Wrong controller user!");
            return;
        }

        var        shotTransform = Instantiate(attackScript.projectile) as Transform;
        Projectile projectile    = shotTransform.GetComponent <Projectile>();

        if (targeting)
        {
            shotTransform.position = controller.aPlayer.position;
        }
        else
        {
            shotTransform.position = controller.thisTransform.position;
        }
        MouseInformation info = new MouseInformation();

        info.position1 = controller.thisTransform.position;
        info.setPosition2(controller.aPlayer.position);
        if (setRotation)
        {
            float rotation = info.rotationInternal * 180 / Mathf.PI;
            shotTransform.localRotation = Quaternion.AngleAxis(rotation, Vector3.forward);
        }

        projectile.isEnemy  = true;
        projectile.multiHit = attackScript.multihit;
        projectile.SetDamage(attackScript.damage, 0, 1);
        projectile.impactSound = controller.values.attackImpactSfx;
        projectile.SetMovement(attackScript.speed, info.rotationInternal);

        attackScript.bgui.effectList.Add(projectile);

        if (controller.values.attackActivateSfx != null)
        {
            controller.currentSfx.value.Enqueue(controller.values.attackActivateSfx.clip);
            controller.playSfxEvent.Invoke();
        }

        float startPoint = Random.Range(0, 2 * Mathf.PI);

        for (int i = 0; i < circleProjectiles; i++)
        {
            Projectile circleProj = Instantiate(projectile);
            Vector3    offset     = circleOffset * new Vector3(Mathf.Cos(startPoint), Mathf.Sin(startPoint), 0);
            circleProj.transform.position += offset;
            startPoint += 2 * Mathf.PI / circleProjectiles;
            attackScript.bgui.effectList.Add(circleProj);
        }
    }
Example #25
0
 void Start()
 {
     Static          = this;
     playerScript    = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
     attackScript    = GameObject.FindGameObjectWithTag("Player").GetComponent <AttackScript>();
     swipe_Initial_X = 0.0f;
     swipe_Initial_Y = 0.0f;
     swipe_Final_X   = 0.0f;
     swipe_Final_Y   = 0.0f;
     present_Input_X = 0.0f;
     present_Input_Y = 0.0f;
 }
    public void StartAttack(Attack attack)
    {
        print("Cast projectile + " + attack.name);
        GameObject   attackObject = new GameObject("Projectile");
        AttackScript spell        = attackObject.AddComponent <AttackScript>();

        if (attack.attackPath != Attack.AttackPath.Meteor ||
            attack.attackPath != Attack.AttackPath.CrashDown ||
            attack.attackPath != Attack.AttackPath.Homing)
        {
            spell.attackPath = Attack.AttackPath.None;

            spell.transform.Translate(Vector2.MoveTowards(spell.transform.position, players[Random.Range(0, players.Length - 1)].transform.position, spell.xSpeed) * spell.xSpeed);
        }


        if (attack.attackType == Attack.AttackType.Special && attack.attackPath == Attack.AttackPath.Homing)
        {
        }


        if (attack.attackPath != Attack.AttackPath.CrashDown || attack.attackPath != Attack.AttackPath.Meteor)
        {
            //direction
            spell.flipped = !ec.m_FacingRight;
        }

        spell.attack = attack;
        //spell.usingEnemy = this;

        if (attack.attackPath == Attack.AttackPath.Meteor || attack.attackPath == Attack.AttackPath.CrashDown)
        {
            spell.origin = spellCastPoint.position;
        }
        else if (attack.attackPath == Attack.AttackPath.Homing)
        {
            spell.origin = spellCastPoint.position;
        }
        else
        {
            spell.origin = spellCastPoint.position;
        }

        spell.direction = direction;
        spell.user      = gameObject.name;

        if (attack.simultaneousAttack != null)
        {
            StartAttack(attack.simultaneousAttack);
        }

        state = BossState.attacked;
    }
Example #27
0
    public void CastProjectile(Attack projectile)
    {
        print("cast projectile");
        GameObject   projectileObject = new GameObject("projectile");
        AttackScript spell            = projectileObject.AddComponent <AttackScript>();

        spell.flipped   = !ec.m_FacingRight;
        spell.attack    = projectile;
        spell.origin    = spellCastPoint.position;
        spell.direction = ec.m_FacingRight ? 1 : -1;
        spell.user      = gameObject.name;
    }
Example #28
0
 private void Start()
 {
     infoTemp     = GetComponent <Info>();
     movementTemp = GetComponent <MovementScript>();
     attackTemp   = GetComponent <AttackScript>();
     agentTemp    = GetComponent <UnityEngine.AI.NavMeshAgent>();
     if (infoTemp)
     {
         isMinion = infoTemp is MinionInfo;
         isHero   = infoTemp is HeroInfo;
     }
 }
Example #29
0
 // Use this for initialization
 void Start()
 {
     // health variable initialization.
     health = 100;
     // Grab the player gameobject.
     player = GameObject.FindGameObjectWithTag("Player");
     // script variable intitalization.
     movScript = player.GetComponent <MovementScript>();
     attScript = player.GetComponent <AttackScript>();
     // Subcribe to events.
     Subscribe();
 }
Example #30
0
 // Use this for initialization
 void Start()
 {
     Door              = GameObject.FindGameObjectWithTag("Door");
     Sword             = GameObject.FindGameObjectWithTag("Sword");
     attackScript      = Sword.GetComponent <AttackScript>();
     Collectable       = GameObject.FindGameObjectWithTag("Player");
     CollectableScript = Collectable.GetComponent <Collectables>();
     menu.SetActive(false);
     ShopText.SetActive(false);
     ShopCam.SetActive(false);
     DoorCam.SetActive(false);
 }
Example #31
0
 // Use this for initialization
 void Start()
 {
     gameManager = GameObject.Find("GameManager");
     ActionList  = GameObject.Find("ActionList");
     Debug.Log(ActionList);
     battleState = performAction.WAIT;
     enemies.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));
     heroes.Add(GameObject.FindGameObjectWithTag("Player"));
     heroInput = heroGUI.ACTIVATE;
     //ActionList.SetActive(false);
     myAction = GameObject.FindGameObjectWithTag("Player").GetComponent <AttackScript>();
 }
    public void UpdateAbility(TotemScript.AttackModifier newState)
    {
        var AttackScripts = AllAbilities.GetComponents<AttackScript>();
        foreach (AttackScript atkScript in AttackScripts) {

            if (atkScript.GetType().Name == newState.ToString())
            {
                currentAbility = atkScript;
                break;
            }
        }
    }
Example #33
0
	public void aiAct() {

		//Perform decision making based off of decision parameters decided by overarching AI.
		System.Random random = new System.Random();
		//Check if idle behavior instead of non-idle.
		if(random.NextDouble() < moveIdle) {
			moveDirB = MoveDirBehavior.IDLE;
		} else {
			//Check if offensive movement behavior instead of defensive.
			if(random.NextDouble() < moveDir)
				moveDirB = MoveDirBehavior.TOWARD;
			else
				moveDirB = MoveDirBehavior.AWAY;
		}
		//Check if global movement behavior instead of non-global.
		if(random.NextDouble() > moveGlobalScope) {
			moveScopeB = MoveScopeBehavior.GLOBAL;
		} else {
			//Check if macro movement behavior instead of micro.
			if(random.NextDouble() > moveScope)
				moveScopeB = MoveScopeBehavior.MACRO;
			else
				moveScopeB = MoveScopeBehavior.MICRO;
		}
		//Check if head target behavior instead of body.
		if(random.NextDouble() > moveTarget)
			moveTargetB = MoveTargetBehavior.HEAD;
		else
			moveTargetB = MoveTargetBehavior.BODY;
		//Check if ally target behavior instead of enemy.
		if(random.NextDouble() > moveTeam)
			moveTeamB = MoveTeamBehavior.ALLY;
		else
			moveTeamB = MoveTeamBehavior.ENEMY;
		//Check if macro behavior instead of micro.
		if(random.NextDouble() > attack)
			attackB = AttackBehavior.MACRO;
		else
			attackB = AttackBehavior.MICRO;

		//Possible blocks to attack.
		LinkedList<GridBlock> attackBlocks = getAttackBlocks();
		//Choose the block to attack from attack block list.
		GridBlock attackBlock = chooseAttackBlock(attackBlocks);

		//Check if there's nowhere to attack or enemy is stronger, then move or attack.
		if(attackBlocks.Count == 0 || attackBlock.unitInstalled.getHealthPercentage() > unit.getHealthPercentage()) {
			//Get the list of blocks to move to.
			LinkedList<GridBlock> moveBlockList = getMoveBlockList();

			foreach(GridBlock b in moveBlockList) {
				MoveScript ms = new MoveScript(unit, b);
			}
		} else {
			AttackScript ms = new AttackScript(unit, attackBlock);
		}
	}
Example #34
0
	public void attackActionWantsToAttackHere(AttackScript attack, UnitScript unitAttacking){
		// Unit can't attack nothing or itself.
		if(unitInstalled != null && unitInstalled != unitAttacking){
			if(attackActionID == -1){
				attackActionID = spriteDisplayScript.displayAction(gridManager.spritesAndColors.sprite_attack);
				actionWaitingForUserInput = attack;
			} else{
				Debug.Log("attack action already displayed");
			}
		}
	}
Example #35
0
    // Use this for initialization
    void Start()
    {
        cameraForwardDir = cameraTransform.forward;
        cameraForwardDir.y = 0;
        cameraForwardDir = cameraForwardDir.normalized;

        updateCameraPosition();
        Vector3 forward = transform.position - cameraTransform.position;
        cameraTransform.forward = forward;

        anim = GetComponent<Animation>();

        player = GetComponent<Player>();

        bullets = (ParticleSystem)GameObject.FindGameObjectWithTag("gun").GetComponent<ParticleSystem>();

        unitData = GetComponent<UnitData>();
        attackScript = GetComponent<AttackScript>();
    }
Example #36
0
    void Start()
    {
        // Assign relevent components and properties
        unitData = this.gameObject.GetComponent<UnitData>();
        attackScript = this.gameObject.GetComponent<AttackScript>();
        player = GameObject.Find("Player");

        // bombers and missiles can explode, while rocket units can generate missiles
        if(unitData.UnitType == UnitData.UNIT_TYPE_AI_BOMBER || unitData.UnitType == UnitData.UNIT_TYPE_AI_MISSILE){
            explosionSphere = (GameObject)Resources.Load("AI/Explosion");
        }else if(unitData.UnitType == UnitData.UNIT_TYPE_AI_ROCKET){
            missileTemplate = (GameObject)Resources.Load("AI/Missile");
        }

        // This value is only used by rocket units
        missileStart = Time.time;
    }