Exemple #1
0
    //private float dashInterruptTime = 1f;
    //private Vector2 dashInterruptVetcor = new Vector2(4, 0);
    void Awake()
    {
        canFight = GetComponent <CanFight>();
        if (canFight == null)
        {
            Debug.LogError("在" + gameObject.name + "中,找不到CanFight组件!");
        }

        //使用string数组初始化canFight能够检测到的层
        string[] targets = new string[1];
        targets[0] = targetLayerName;
        canFight.Initiailize(targets);

        movementComponent = GetComponent <MovementMinotaur>();
        if (movementComponent == null)
        {
            Debug.LogError("在" + gameObject.name + "中,找不到MovementPlayer组件!");
        }

        poolManager     = GameObject.Find("PoolManager").GetComponent <PoolManager>();
        cutColl         = GameObject.Find("CutColl").GetComponent <Collider2D>();
        whirlWindColl   = GameObject.Find("WhirlWindColl").GetComponent <Collider2D>();
        cameraTransform = GameObject.Find("Main Camera").transform;

        //火球位置
        flyingFromDirection = new Vector2(movementComponent.originx - 3f, 10f);

        //用于行为树的一些参数
        canActiveAttack = true;
        attackLength    = 2f;

        //技能cd
        skillCD1 = 3f;
        skillCD2 = 8f;
        skillCD3 = 10f;
        skillCD4 = 15f;
    }
Exemple #2
0
    public override void Initialize()
    {
        priorityInType = 2;
        coll           = GetComponent <CapsuleCollider2D>();

        movementComponent = GetComponent <MovementMinotaur>();
        if (movementComponent == null)
        {
            Debug.LogError("在Witcher中,没有找到Movement脚本!");
        }
        attackComponent = GetComponent <MinotaurAttack>();
        if (attackComponent == null)
        {
            Debug.LogError("在Witcher中,没有找到Attack脚本!");
        }

        defenceComponent = GetComponent <DefenceEnemies>();
        if (defenceComponent == null)
        {
            Debug.LogError("在Witcher中,没有找到Defence脚本!");
        }
        //设置最大生命值
        defenceComponent.Initialize(100);
    }