コード例 #1
0
 private void OnDestroy()
 {
     foreach (Vector2Int d in data)
     {
         FlowFieldGenerator.GetInstance().Regenerate(d);
     }
 }
コード例 #2
0
ファイル: Enemy.cs プロジェクト: JamesKDesign/Grave_Terror
 //Attack and deal damage if a player was hit
 public void Attack()
 {
     action = E_ACTION.ATTACK;
     //If there is no valid target in the attackbox then the attack is missed
     if (attackHitbox.target != null)
     {
         attackHitbox.target.transform.GetComponent <PlayerHealth>().DamagePlayer(attackDamage);
         if (attackHitbox.target.transform.GetComponent <PlayerHealth>().playerState == PlayerHealth.PlayerState.ALIVE)
         {
             //Set 0 to 1 and 1 to 0
             path = FlowFieldGenerator.GetInstance().AttemptTarget(path * -1 + 1);
         }
         //DEBUG
         //transform.Find("AttackEffect").GetComponent<ParticleSystem>().Play();
         Debug.Log("attacking " + attackHitbox.target.name);
     }
 }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: JamesKDesign/Grave_Terror
    // Use this for initialization
    void Start()
    {
        behaviours.Add(new EnemyPathing(this, pathingWeight));
        behaviours.Add(new EnemyFlocking(this, flockingWeight));
        behaviours.Add(new EnemyWander(this, wanderWeight)); //This one needs work

        cc = GetComponent <CharacterController>();

        anim = GetComponent <Animator>();

        health = GetComponent <EnemyHealth>();

        attackHitbox = transform.Find("AttackBox").GetComponent <EnemyAttackBox>();

        p1HP = FlowFieldGenerator.GetInstance().targets[0].GetComponent <PlayerHealth>();
        p2HP = FlowFieldGenerator.GetInstance().targets[1].GetComponent <PlayerHealth>();
    }
コード例 #4
0
 private void Awake()
 {
     instance = this;
 }
コード例 #5
0
 //Initialization
 public EnemyPathing(Enemy _enemy, float _weight = 1.0f) : base(_enemy, _weight)
 {
     FFG = FlowFieldGenerator.GetInstance();
 }