Inheritance: MonoBehaviour
示例#1
0
 private void OnEnable()
 {
     anim.SetBool(AnimHash.Walk, false);
     anim.SetBool(AnimHash.Attack, false);
     anim.SetBool(AnimHash.Dead, false);
     hpBar = HPBarPool.instance.GetFromPool();
 }
示例#2
0
 void Start()
 {
     anim         = GetComponent <Animator>();
     navMeshAgent = GetComponent <NavMeshAgent>();
     EHText       = EnemyHealth.GetComponentInChildren <Text>();
     EnemyHealth.SetActive(false);
     ehpb = EnemyHealth.GetComponent <EnemyHPBar>();
 }
示例#3
0
    public EnemyHPBar GetFromPool()
    {
        for (int i = 0; i < pool.Count; i++)
        {
            if (!pool[i].gameObject.activeInHierarchy)
            {
                pool[i].gameObject.SetActive(true);
                return(pool[i]);
            }
        }
        //EnemyHPBar newObj = Instantiate(origin);
        //newObj.transform.SetParent(canvas);
        //newObj.transform.localScale = Vector3.one;
        EnemyHPBar newObj = Instantiate(origin, canvas);

        pool.Add(newObj);
        return(newObj);
    }
示例#4
0
    // Use this for initialization
    public void Instantiate()
    {
        PLKP       = GameObject.Find("PlayerLastKnownPosition").transform;
        player     = GameObject.Find("player");
        head       = transform.Find("body");
        headScript = head.GetComponent <Head>();
        animator   = GetComponent <Animator>();

        alertionIndicatorAnimator       = transform.Find("EnemyCanvas/AlertionIndicator").GetComponent <Animator>();
        alertionIndicatorSpriteRenderer = transform.Find("EnemyCanvas/AlertionIndicator").GetComponent <SpriteRenderer>();
        targetInVisionSprite            = Resources.Load <Sprite>("e");
        isAlertedSprite = Resources.Load <Sprite>("q");

        aiDestinationSetter = GetComponent <AIDestinationSetter>();
        aiPatrol            = GetComponent <Patrol>();
        ai = GetComponent <IAstarAI>();
        playerAllerting = player.GetComponent <Allerting>();
        HpBar           = transform.Find("EnemyCanvas").GetComponent <EnemyHPBar>();
        HpBar.Initiate();
        healthCurrent = healthMax;
        normalSpeed   = ai.maxSpeed;
        alertedSpeed  = normalSpeed;
    }
    protected override void Awake()
    {
        base.Awake();


        SetGizmoColor(Color.red);

        _cc    = GetComponentInChildren <CapsuleCollider>();
        _stat  = GetComponent <PlayerStat>();
        _anim  = GetComponentInChildren <Animator>();
        _Sound = GetComponent <PlayerSound>();
        rigid  = GetComponent <Rigidbody>();

        CMvcam2 = GameObject.Find("CMvcam2").GetComponent <Cinemachine.CinemachineVirtualCamera>();

        vignette     = GameObject.Find("mainCam").GetComponent <PostProcessVolume>().profile.GetSetting <Vignette>();
        colorGrading = GameObject.Find("mainCam").GetComponent <PostProcessVolume>().profile.GetSetting <ColorGrading>();

        bloom          = GameObject.Find("mainCam").GetComponent <PostProcessVolume>().profile.GetSetting <Bloom>();
        Attack_Capsule = GameObject.FindGameObjectWithTag("Weapon").GetComponent <CapsuleCollider>();
        Skill3_Capsule = Skill3_Start.GetComponent <CapsuleCollider>();
        enemyHPBar     = GameObject.Find("EnemyHPBar").GetComponent <EnemyHPBar>();
        Skill1Shoots.gameObject.SetActive(false);
        instance     = this;
        isSkill2     = false;
        isInputLock  = false;
        isSpecial    = false;
        isMouseYLock = false;
        try
        {
            Skill3_Start.SetActive(false);
            Skill3_End.SetActive(false);
        }
        catch
        {
        }
        randomShoot = new int[5];

        PlayerState[] stateValues = (PlayerState[])System.Enum.GetValues(typeof(PlayerState));
        foreach (PlayerState s in stateValues)
        {
            System.Type FSMType = System.Type.GetType("Player" + s.ToString());
            FSMState    state   = (FSMState)GetComponent(FSMType);
            if (null == state)
            {
                state = (FSMState)gameObject.AddComponent(FSMType);
            }

            _states.Add(s, state);
            state.enabled = false;
        }

        for (int x = 0; x < _MR.Length; x++)
        {
            materialList.AddRange(_MR[x].materials);
        }
        remainingDash = 3;

        try
        {
            mission = GameObject.Find("Tutorial").GetComponent <MissionTutorial>();
        }
        catch
        {
            mission = null;
        }
    }
示例#6
0
 // Use this for initialization
 void Start()
 {
     HpBar = transform.Find("EnemyCanvas").GetComponent <EnemyHPBar>();
     HpBar.Initiate();
     healthCurrent = healthMax;
 }