Пример #1
0
    void OnTriggerStay2D(Collider2D coll)
    {
        //Debug.Log ("Collision");
        if (coll.gameObject.tag == "Player" && Input.GetMouseButtonDown(1))
        {
            //code to add weapon to player
            Debug.Log("Player picked up: " + name);
            if (wa.getCur() != null)
            {
                wa.dropWeapon();
            }
            wa.setWeapon(this.gameObject, name, fireRate, gun, oneHanded, shotugn);        //added one handed
            //Destroy (this.gameObject);
            this.gameObject.SetActive(false);
        }
        else if (coll.gameObject.tag == "Enemy" && coll.gameObject.GetComponent <EnemyWeaponController>().getCur() == null)  //New for tut 7
        {
            Debug.Log("Enemy picked up: " + name);

            EnemyWeaponController ewc = coll.gameObject.GetComponent <EnemyWeaponController> ();
            ewc.setWeapon(this.gameObject, name, fireRate, gun, oneHanded, shotugn);        //added one handed
            //Destroy (this.gameObject);
            this.gameObject.SetActive(false);
        }
    }
 protected void Fire(EnemyWeaponController weaponCtrl)
 {
     if (weaponCtrl == null)
     {
         return;
     }
     weaponCtrl.Fire(inputStatus);
 }
Пример #3
0
 void Start()
 {
     GetComponent <EnemyController>().SetHealth(maxHealth);
     target          = GameObject.Find("Player");
     aiSetter        = GetComponent <AIDestinationSetter>();
     aiSetter.target = target.transform;
     weapon          = GetComponentInChildren <EnemyWeaponController>();
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     player        = GameObject.FindGameObjectWithTag("Player");
     playerLastPos = this.transform.position;
     obj           = GameObject.FindGameObjectWithTag("GameController").GetComponent <ObjectManager> ();
     ewc           = this.GetComponent <EnemyWeaponController> ();
     rid           = this.GetComponent <Rigidbody2D> ();
     layerMask     = ~layerMask;
 }
    //攻撃
    protected void Fire(List <EnemyWeaponController> weaponCtrlList, int level = 0)
    {
        EnemyWeaponController weaponCtrl = SelectWeapon(weaponCtrlList, level);

        if (weaponCtrl == null)
        {
            return;
        }
        Fire(weaponCtrl);
    }
    protected EnemyWeaponController EquipEnemyWeapon(GameObject obj, int level = 1)
    {
        WeaponController      wc  = EquipWeapon(obj);
        EnemyWeaponController ewc = (EnemyWeaponController)wc;

        if (ewc != null)
        {
            ewc.SetEnemy(this, level);
        }
        return(ewc);
    }
    //////////////////Key Stats


    void Awake()
    {
        HE        = GetComponent <HumanoidEnemy>();
        EWC       = GetComponentInChildren <EnemyWeaponController>();
        EAU       = GetComponentInChildren <EnemyAnimationUpdater>();
        EA        = GetComponentInChildren <EnemyArmor>();
        ID        = GetComponentInChildren <InteractiveDia>();
        EH        = GetComponentInChildren <EnemyHealth>();
        DR        = GetComponentInChildren <DiaRoot>();
        selfTrans = transform.Find("Hitbox");
    }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        eai = this.GetComponent <EnemyAI> ();
        sc  = GameObject.FindGameObjectWithTag("GameController").GetComponent <SpriteContainer>();

        torsoSpr     = sc.getEnemyWalk("");
        attackingSpr = sc.getEnemyWeapon("");

        ewc     = this.GetComponent <EnemyWeaponController> ();
        legsSpr = sc.getPlayerLegs();
    }
Пример #9
0
	void Awake (){
		rigid = GetComponent<Rigidbody2D> ();
		GameObject playerObj = GameObject.FindGameObjectWithTag ("Player");
		if (playerObj != null) {
			target = playerObj.transform;
		}
		//Get all the Scripts needed;
		_enemy = GameObject.FindGameObjectWithTag("Enemy");
		if(_enemy != null){
			_enemyMove = _enemy.GetComponent<EnemyMove>();
			_enemyHealth = _enemy.GetComponent<EnemyHealth> ();
			_enemyShoot = _enemy.GetComponent<EnemyWeaponController> ();
			_enemyEvade = _enemy.GetComponent<EnemyEvasiveManouver> ();
			_enemyPatrol = _enemy.GetComponent<EnemyPatrolling> ();
			_enemyChasing = _enemy.GetComponent<EnemyChasing> ();
		} else {
			print("Something went Wrong; Could not find this Enemy "+this+" in this scene");
		}
	}
Пример #10
0
    public virtual void StartWeapon(bool EnemyWeapon_in = false, EnemyTemplateMaster ETM_in = null, HumanoidWeaponExpertise humanoidWeaponExpertise = HumanoidWeaponExpertise.Adept)
    {
        EnemyWeapon = EnemyWeapon_in;
        player      = GameObject.Find("Player").transform;

        if (EnemyWeapon_in)
        {
            FL                    = GameObject.Find("NPCs").GetComponent <FactionLogic>();
            ETM                   = ETM_in;
            WeaponExpertise       = humanoidWeaponExpertise;
            enemyAnimationUpdater = GetComponentInParent <EnemyAnimationUpdater>();
            enemyWeaponController = GetComponentInParent <EnemyWeaponController>();
        }
        else
        {
            playMove         = player.GetComponentInChildren <PlayerMovement>();
            animationUpdater = player.GetComponentInChildren <PlayerAnimationUpdater>();
            energy           = player.GetComponent <Energy>();
            stats            = player.GetComponent <PlayerStats>();
        }
    }
Пример #11
0
 //武器設定
 protected override void SetWeapon()
 {
     base.SetWeapon();
     weaponCtrlList   = EquipEnemyWeapon(weaponList);
     shieldWeaponCtrl = EquipEnemyWeapon(shieldWeapon);
 }
Пример #12
0
 private void Awake()
 {
     _eWC       = FindObjectOfType <EnemyWeaponController>();
     _startTime = Time.time;
 }
Пример #13
0
 // Use this for initialization
 void Start()
 {
     WeaponController = GetComponent <EnemyWeaponController>();
     Stats            = GetComponent <Objectstats>();
 }
Пример #14
0
 public void Launch(Transform target, EnemyWeaponController weaponController)
 {
     this.targetTransfor   = target;
     this.weaponController = weaponController;
     this.weaponController.PlayerTeleported += OnPlayerTeleported;
 }