예제 #1
0
 public override void Initialize()
 {
     base.Initialize();
     playerAnim.SetSpell(this, SkillType.SelfExplosion);
     defencePlayer = player.GetComponent <DefencePlayer>();
     canFight      = player.GetComponent <CanFight>();
     canBeFighted  = player.GetComponent <CanBeFighted>();
 }
예제 #2
0
    public override void Initialize()
    {
        base.Initialize();

        maxExistTime  = 5f;
        speed         = 5f;
        playerLayer   = LayerMask.NameToLayer("Player");
        defencePlayer = GameObject.Find("Player").GetComponent <DefencePlayer>();
    }
예제 #3
0
    public override void Initialize()
    {
        base.Initialize();
        defencePlayer = player.GetComponent <DefencePlayer>();

        waterShield = GameObject.Find("WaterShield");
        waterShield.SetActive(false);
        if (waterShield == null)
        {
            Debug.Log("在PlayerAnim中没有找到waterShield!");
        }
        playerAnim.SetSpell(this, SkillType.IceFire);
    }
예제 #4
0
 // 加载collider
 protected override void Awake()
 {
     base.Awake();
     movementComponent = player.GetComponent <MovementPlayer>();
     defenceComponent  = player.GetComponent <DefencePlayer>();
 }
예제 #5
0
    public override void Initialize()
    {
        //判断平台
        platformJudge = GameObject.Find("ControllerMode").GetComponent <PlatformJudge>();
        if (platformJudge == null)
        {
            Debug.LogError("找不到ControllerMode");
        }
        platform = platformJudge.GetPlatform();
        if (platform == PlatformJudge.Platfrom.ANDROID || platform == PlatformJudge.Platfrom.IOS || platform == PlatformJudge.Platfrom.WEB_MOBILE)
        {
            joystick = GameObject.Find("Variable Joystick").GetComponent <Joystick>();
            if (joystick == null)
            {
                Debug.LogError("移动端获取摇杆失败!");
            }

            aButton = GameObject.Find("AButton").GetComponent <MainElementButton>();
            bButton = GameObject.Find("BButton").GetComponent <SupportingElementButton>();
            cButton = GameObject.Find("CButton").GetComponent <SupportingElementButton>();

            jumpButton     = GameObject.Find("JumpButton").GetComponent <SimpleButton>();
            interactButton = GameObject.Find("InteractButton").GetComponent <SimpleButton>();
        }

        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 <MovementPlayer>();
        if (movementComponent == null)
        {
            Debug.LogError("在Player中,没有找到MovementPlayer脚本!");
        }
        abilityManager = GetComponent <ElementAbilityManager>();
        //attackComponent = GetComponent<AttackPlayer>();
        //if (attackComponent == null)
        //{
        //    Debug.LogError("在Player中,没有找到AttackPlayer脚本!");
        //}

        defenceComponent = GetComponent <DefencePlayer>();
        if (defenceComponent == null)
        {
            Debug.LogError("在Player中,没有找到DefencePlayer脚本!");
        }
        defenceComponent.Initialize(5);

        interactivePlayer = GetComponent <InteractivePlayer>();

        //初始化心心数
        GameObject HpPanel = GameObject.Find("HP Panel");

        hpArray = new HPItem[defenceComponent.getHpMax()];

        for (int i = 0; i < defenceComponent.getHp(); i++)
        {
            Transform hpItem = HpPanel.transform.GetChild(i);
            hpArray[i] = hpItem.GetComponent <HPItem>();
            hpArray[i].Getting();
        }
    }
예제 #6
0
 public override void Initialize()
 {
     base.Initialize();
     playerAnim.SetSpell(this, Spell.SkillType.IceHeal);
     defencePlayer = player.GetComponent <DefencePlayer>();
 }