Ejemplo n.º 1
0
    void Start()
    {
        sr       = GetComponent <SpriteRenderer>();
        mDefault = sr.material;

        player       = GameObject.FindGameObjectWithTag("Player").transform;
        playerCombat = player.GetComponent <PlayerCombat>();
        //playerCombat = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerCombat>();

        TextPopupsHandler = GameObject.Find("ObjectPool(TextPopups)").GetComponent <TextPopupsHandler>();
        AttackIndicator   = GameObject.Find("ObjectPool(Attack/Alert Indicators)").GetComponent <TextPopupsHandler>();

        //Stats
        currentHealth = maxHealth;
        healthBar.SetMaxHealth(maxHealth);
        isAlive     = true;
        enCanAttack = true;
        allowBreak  = false;
        isBroken    = false;
        //AI aggro
        rb = GetComponent <Rigidbody2D>();
        enAnimator.SetBool("Move", false);
        isAttacking  = false;
        aggroStarted = false;
        enIsHurt     = false;
        enStunned    = false;
        particleHits = false;
        atkSequence  = 1;
    }
Ejemplo n.º 2
0
    protected virtual void Start()
    {
        sr = GetComponent <SpriteRenderer>();
        rb = GetComponent <Rigidbody2D>();

        mDefault           = sr.material;
        healthBarTransform = healthBar.GetComponent <Transform>();

        TextPopupsHandler     = GameObject.Find("ObjectPool(TextPopups)").GetComponent <TextPopupsHandler>();
        AttackIndicator       = GameObject.Find("ObjectPool(Attack/Alert Indicators)").GetComponent <TextPopupsHandler>();
        HitEffectsHandler     = GameObject.Find("ObjectPool(HitEffects)").GetComponent <HitEffectsHandler>();
        DeathParticlesHandler = GameObject.Find("ObjectPool(DeathParticles)").GetComponent <DeathParticlesHandler>();

        if (stageClear == null)
        {
            stageClear = GetComponentInParent <StageClear>();
        }
        //stageClear = GameObject.Find("StageClearCheck").GetComponent<StageClear>();


        //if (useScreenshake)
        //    screenshake = GameObject.Find("ScreenShakeManager").GetComponent<ScreenShakeListener>();

        currentHealth = maxHealth;
        if (healthBar != null)
        {
            healthBar.SetMaxHealth(maxHealth);
        }

        moveSpeed  = defaultMoveSpeed;
        moveSpeed += Random.Range(-.2f, .1f);
        enCanFlip  = true;
        enCanMove  = true;

        isAttacking = false;
        enCanAttack = true;
        enStunned   = false;
        enCanParry  = false;

        isAlive   = true;
        isHurt    = false;
        enStunned = false;
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        sr       = GetComponent <SpriteRenderer>();
        rb       = GetComponent <Rigidbody2D>();
        mDefault = sr.material;

        healthBarTransform = healthBar.GetComponent <Transform>();

        TextPopupsHandler     = GameObject.Find("ObjectPool(TextPopups)").GetComponent <TextPopupsHandler>();
        AttackIndicator       = GameObject.Find("ObjectPool(Attack/Alert Indicators)").GetComponent <TextPopupsHandler>();
        HitEffectsHandler     = GameObject.Find("ObjectPool(HitEffects)").GetComponent <HitEffectsHandler>();
        DeathParticlesHandler = GameObject.Find("ObjectPool(DeathParticles)").GetComponent <DeathParticlesHandler>();

        moveSpeed  = moveSpeedDefault;
        enCanFlip  = true;
        enCanMove  = true;
        enCanParry = false;

        isAttacking  = false;
        aggroStarted = false;
        enIsHurt     = false;
        enStunned    = false;
        knockbackHit = false;

        isAlive     = true;
        enCanAttack = true;

        //Stats
        currentHealth = maxHealth;
        if (healthBar != null)
        {
            healthBar.SetMaxHealth(maxHealth);
        }

        moveSpeed += Random.Range(-.2f, .1f);

        bool startDir = (Random.value > 0.5f);

        MoveRight(startDir);
    }
Ejemplo n.º 4
0
    //TODO: this should work??
    //float aggroRange = 3f; //when to start chasing player
    //might extend to aggro to player before enemy enters screen

    //float enAttackRange = .5f; //when to start attacking player, stop enemy from clipping into player
    //public Transform enAttackPoint

    //Coroutine IsAttackingCO;

    //[Header("Attack variables")]
    //RaycastHit2D aggroRaycast;

    //SpriteRenderer sr;
    //[SerializeField]
    //private Material mWhiteFlash;
    //private Material mDefault;


    void Start()
    {
        AttackIndicator = GameObject.Find("ObjectPool(Attack/Alert Indicators)").GetComponent <TextPopupsHandler>();

        timeManager = GameObject.Find("TimeManager").GetComponent <TimeManager>();



        //enController.enCanMove = true;
        //enCanAttack = true;
        //AI aggro
        // rb = GetComponent<Rigidbody2D>();
        enController.enAnimator.SetBool("move", false); //TODO: unnecessary
        enController.stunAnimatorVar = "en2StunRecover";
        //enController.enAnimator.SetBool("isRunning", false);
        //enController.enFacingRight = false; //start facing left (towards player start)
        //isAttacking = false;
        //aggroStarted = false;
        //enIsHurt = false;
        //enStunned = false;
        //canChase = true;
        allowBreak = false;
        isBroken   = false;
    }