public void Bomb() { throwerHand.Initiailize(targetsName); throwerHand.AttackArea(coll, 2, AttackInterruptType.WEAK); throwerHand.Initiailize(originName); //播放爆炸动画 poolManager.RemoveGameObject(REMOTE_CONTROL_BOMB_NAME, gameObject); }
protected override void Start() { base.Start(); ground = LayerMask.GetMask("Platform"); coll = GetComponent <Collider2D>(); if (coll == null) { Debug.LogError("在" + gameObject.name + "中,找不到collider"); } //初始化目标层级 layers.Add(LayerMask.NameToLayer("Player")); layers.Add(LayerMask.NameToLayer("Enemy")); //初始化canFight canFight = GetComponent <CanFight>(); if (canFight == null) { Debug.LogError("在" + gameObject.name + "中,找不到canFight"); } string[] targetLayer = new string[2]; targetLayer[0] = "Player"; targetLayer[1] = "Enemy"; canFight.Initiailize(targetLayer); enabled = false; }
protected override void Start() { base.Start(); speed = originalFlowSpeed; startPosition = transform.position; ground = LayerMask.GetMask("Platform"); spriteRenderer = GetComponent <SpriteRenderer>(); if (spriteRenderer == null) { Debug.LogError("在" + gameObject.name + "中,找不到spriteRenderer"); } //颜色初始化 originalColor = spriteRenderer.color; transparentColor = spriteRenderer.color; transparentColor.a = 0.0f; //碰撞体初始化 coll = GetComponent <Collider2D>(); if (coll == null) { Debug.LogError("在" + gameObject.name + "中,找不到collider"); } //初始化目标层级 layers.Add(LayerMask.NameToLayer("Player")); layers.Add(LayerMask.NameToLayer("Enemy")); //初始化canFight canFight = GetComponent <CanFight>(); if (canFight == null) { Debug.LogError("在" + gameObject.name + "中,找不到canFight"); } string[] targetLayer = new string[2]; targetLayer[0] = "Player"; targetLayer[1] = "Enemy"; canFight.Initiailize(targetLayer); enabled = false; }
//StringBuilder targetsName = new StringBuilder(); public override void Initialize() { base.Initialize(); normalAttackArea = GameObject.Find("NormalAttack").GetComponent<Collider2D>(); canFight = player.GetComponent<CanFight>(); //使用string数组初始化canFight能够检测到的层 string[] targets = new string[1]; targets[0] = targetLayerName; canFight.Initiailize(targets); playerAnim.SetSpell(this, SkillType.IceSword); iceAbility = player.GetComponent<IceAbility>(); iceShotFreezingZone = GameObject.Find("IceShotFreezingZone").GetComponent<BoxCollider2D>(); if (iceShotFreezingZone == null) { Debug.LogError("iceShotFreezingZone为空"); } }
private void Start() { poolManager = GameObject.Find("PoolManager").GetComponent <PoolManager>(); if (poolManager == null) { Debug.LogError("在" + gameObject.name + "中,获取PoolManager失败"); } canFight = GetComponent <CanFight>(); if (canFight == null) { Debug.LogError("在" + gameObject.name + "中,获取CanFight失败"); } //使用string数组初始化canFight能够检测到的层 string[] targets = new string[1]; targets[0] = "Player"; canFight.Initiailize(targets); }
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(); } }