示例#1
0
    private void Awake()
    {
        this.movement    = this.GetComponent <MovementController>();
        this.meleeDealer = this.GetComponent <MeleeDamageDealer>();
        this.sprite      = this.GetComponent <SpriteRenderer>();
        this.animator    = this.GetComponent <Animator>();
        this.hitbox      = this.GetComponent <BoxCollider2D>();
        this.player      = GameManager.Player;

        this.spikeManager = new GameObject("Spike Manager");
        this.spikeManager.transform.SetParent(GameManager.LevelManager.Active.transform);
        this.spikeManager.transform.position = Vector3.zero;

        this.scythe = Instantiate(this.scythePrefab);
        this.scythe.transform.SetParent(GameManager.LevelManager.Active.transform);
        this.scythe.SetActive(false);

        for (int i = 0; i < 35 / this.spikeSpacing; i++)
        {
            GameObject newSpike = Instantiate(this.spike);
            newSpike.transform.SetParent(this.spikeManager.transform);
            newSpike.transform.position = new Vector2(2.5f + i * this.spikeSpacing, 1.5f);
            newSpike.SetActive(false);
        }

        this.GetComponent <DamageTaker>().OnDie.AddListener(this.OnDeath);
    }
示例#2
0
    private void Awake()
    {
        this.controller  = this.GetComponent <MovementController>();
        this.collider    = this.GetComponent <BoxCollider2D>();
        this.sprite      = this.GetComponent <SpriteRenderer>();
        this.animator    = this.GetComponent <Animator>();
        this.meleeAttack = this.GetComponent <MeleeDamageDealer>();
        this.damageTaker = this.GetComponent <DamageTaker>();
        this.ui          = this.GetComponent <PlayerUI>();

        for (int i = 0; i < 32; i++)
        {
            Physics2D.IgnoreLayerCollision(this.gameObject.layer, i);
        }

        this.meleeAttack.OnDamageHit.AddListener(this.BounceOnDownHit);
        this.meleeAttack.OnDamageHit.AddListener(this.RegenRanged);
        this.damageTaker.OnTakeDamage.AddListener(this.BlinkOnHit);
        this.damageTaker.OnDie.AddListener(this.OnPlayerDie);
    }
示例#3
0
 void Start()
 {
     enemy       = GetComponent <EnemyComponent>();
     meleeAttack = GetComponent <MeleeDamageDealer>();
 }