public override void Initialize() { //获得场景物体引用 thunderCircleObject = GameObject.Find("ThunderCircle"); thunderCircleScript = thunderCircleObject.GetComponent <ThunderCircle>(); thunderCircleRenderer = thunderCircleObject.GetComponent <SpriteRenderer>(); if (thunderCircleScript == null) { Debug.LogError("在ThunderAbility中,没有找到雷圈脚本!"); } movementComponent = GetComponent <MovementPlayer>(); //初始化技能类 thunderLinkSpell = new ThunderLinkSpell(); thunderLinkSpell.Initialize(); thunderBallSpell = new ThunderBallSpell(); thunderBallSpell.Initialize(); thunderLongSpell = new ThunderLongSpell(); thunderLongSpell.Initialize(); thunderIceSpell = new ThunderIceSpell(); thunderIceSpell.Initialize(); thunderElfSpell = new ThunderElfSpell(); thunderElfSpell.Initialize(); thunderElfSpell.Enable(); }
//updateManager中代替start函数的初始化方法 override public void Initialize() { player = GameObject.Find("Player"); playerMovementComponent = player.GetComponent <MovementPlayer>(); if (playerMovementComponent == null) { Debug.LogError("在" + gameObject.name + "的父亲中,找不到MovementPlayer组件!"); } coll = GameObject.Find("Player").GetComponent <CapsuleCollider2D>(); if (coll == null) { Debug.LogError("在" + gameObject.name + "的父亲中,找不到coll2D组件!"); } groundLayer = LayerMask.GetMask("Platform"); waterLayer = LayerMask.GetMask("Water"); keyboard = InputSystem.GetDevice <Keyboard>(); if (keyboard == null) { Debug.LogError("在" + gameObject.name + "中,初始化keyboard失败"); } //给探测器固定位置 ldnx = -coll.size.x / 2 + LRDetectorInsideLength; ldny = -coll.size.y / 2 * detectorInsideOffsetRatio; ldcx = ldnx; ldcy = ldny; ltnx = -coll.size.x / 2 + LRDetectorInsideLength; ltny = coll.size.y / 2; ltcx = ltnx; ltcy = ltny - descentDistance; rdnx = coll.size.x / 2 - LRDetectorInsideLength; rdny = -coll.size.y / 2 * detectorInsideOffsetRatio; rdcx = rdnx; rdcy = rdny; rtnx = coll.size.x / 2 - LRDetectorInsideLength; rtny = coll.size.y / 2; rtcx = rtnx; rtcy = rtny - descentDistance; flnx = -coll.size.x / 2 * detectorInsideOffsetRatio; flny = -coll.size.y / 2 + floorDetectorAsecendDistance; flcx = flnx; flcy = flny; frnx = coll.size.x / 2 * detectorInsideOffsetRatio; frny = -coll.size.y / 2 + floorDetectorAsecendDistance; frcx = frnx; frcy = frny; hlnx = -coll.size.x / 2 * detectorInsideOffsetRatio; hlny = coll.size.y / 2 - 0.029f; hlcx = hlnx; hlcy = hlny - descentDistance; hrnx = coll.size.x / 2 * detectorInsideOffsetRatio; hrny = coll.size.y / 2 - 0.029f; hrcx = hrnx; hrcy = hrny - descentDistance; swtichToNormalStatus(); }
public override void Initialize() { //获得场景物体引用 movementComponent = GetComponent <MovementPlayer>(); sightHead = GameObject.Find("SightHead").GetComponent <SightHead>(); sightHead.gameObject.SetActive(false); //初始化技能类 hurricaneSpell = new HurricaneSpell(); hurricaneSpell.Initialize(); windArrowSpell = new WindArrowSpell(); windArrowSpell.Initialize(); blinkBackSpell = new BlinkBackSpell(); blinkBackSpell.Initialize(); windShortSpell = new WIndShortSpell(); windShortSpell.Initialize(); windThunderSpell = new WindThunderSpell(); windThunderSpell.Initialize(); windFieldSpell = new WindFieldSpell(); windFieldSpell.Initialize(); }
public override void Initialize() { //获得场景物体引用 movementComponent = GetComponent <MovementPlayer>(); //初始化技能类 fireBallSpell = new FireBallSpell(); fireBallSpell.Initialize(); meteoriteSpell = new MeteoriteSpell(); meteoriteSpell.Initialize(); protectiveFireBallSpell = new ProtectiveFireBallSpell(); protectiveFireBallSpell.Initialize(); rocketPackSpell = new RocketPackSpell(); rocketPackSpell.Initialize(); fireThunderSpell = new FireThunderSpell(); fireThunderSpell.Initialize(); //辅助技能直接enable remoteControlBombSpell = new RemoteControlBombSpell(); remoteControlBombSpell.Initialize(); remoteControlBombSpell.Enable(); lavaSpell = new LavaSpell(); lavaSpell.Initialize(); meteorShowerSpell = new MeteorShowerSpell(); meteorShowerSpell.Initialize(); selfExplosionSpell = new SelfExplosionSpell(); selfExplosionSpell.Initialize(); }
/// <summary> /// 被击退函数 击退方向由攻击者和被击者的位置决定,力的大小由参数parameter决定 /// </summary> /// <param name="attackerPos">攻击者</param> /// <param name="interruptTime">击退时间</param> /// <param name="parameter">力大小参数</param> public void BeatBack(Transform attackerPos, float interruptTime, float parameter) { Vector2 fighterPos = attackerPos.transform.position; Vector2 beFightedPos = transform.position; Vector2 interruptVector = (beFightedPos - fighterPos).normalized * parameter; //获取移动组件 //如果被打的是player if (gameObject.name == "Player") { MovementPlayer movement = gameObject.GetComponent <MovementPlayer>(); if (movement.RequestChangeControlStatus(interruptTime, MovementPlayer.PlayerControlStatus.Interrupt)) { movement.RequestMoveByTime(interruptVector, interruptTime, MovementPlayer.MovementMode.Attacked); } } else { MovementEnemies movement = gameObject.GetComponent <MovementEnemies>(); if (movement.RequestChangeControlStatus(interruptTime, MovementEnemies.EnemyStatus.Stun)) { movement.RequestMoveByTime(interruptVector, interruptTime, MovementEnemies.MovementMode.Attacked); } } }
private void Awake() { movementPlayer = GetComponent <MovementPlayer>(); controls = new InputPlayer(); controls.Player.Movement.performed += ctx => movementPlayer.direction = ctx.ReadValue <Vector2>(); }
public override void Initialize() { base.Initialize(); playerAnim.SetSpell(this, SkillType.IceBlink); thunderAbility = player.GetComponent <ThunderAbility>(); movementPlayer = player.GetComponent <MovementPlayer>(); canFight = player.GetComponent <CanFight>(); }
private void Start() { movementPlayer = GameObject.Find("Player").GetComponent <MovementPlayer>(); if (movementPlayer == null) { Debug.LogError("在" + gameObject.name + "中,找不到MovementPlayer组件"); } }
// Start is called before the first frame update void Start() { _rend = GetComponent <SpriteRenderer>(); player = GameObject.Find("Player").GetComponent <MovementPlayer>(); Debug.Log(player.activeSkillNumber); if (!player) { Debug.Log("PLAYERA NEMA"); } }
static bool Prefix(MovementPlayer __instance, int value) { if (Mod.instance.wasAttack) { System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace(); Mod.instance.GetLogger().LogInfo(string.Format("Called with {0}", value)); Mod.instance.GetLogger().LogInfo(t.ToString()); return(false); } return(true); }
void Awake() { // Setting up the references. //anim = GetComponent <Animator> (); playerAudio = GetComponent <AudioSource> (); playerMovement = GetComponent <MovementPlayer> (); //playerShooting = GetComponentInChildren <PlayerShooting> (); // Set the initial health of the player. currentHealth = startingHealth; }
public override void Initialize() { base.Initialize(); rigid = player.GetComponent <Rigidbody2D>(); movementComponent = player.GetComponent <MovementPlayer>(); playerAnim.SetSpell(this, SkillType.RocketPack); rocketPackObject = GameObject.Find("RocketPack"); rocketPackObject.SetActive(false); playerDetector = GameObject.Find("FloorDetector").GetComponent <OnFloorDetector>(); }
void Start() { PV = GetComponent <PhotonView>(); if (!PV.IsMine && PhotonNetwork.IsConnected) { this.enabled = false; } comps = GetComponents <MonoBehaviour>(); rb = GetComponent <Rigidbody2D>(); rs = GetComponentsInChildren <Renderer>(); cam = playerCamera.GetComponent <CameraFollowPlayer>(); movement = GetComponent <MovementPlayer>(); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "HurtBox" || other.tag == "Player") { //die MovementPlayer mp = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementPlayer>(); mp.enemiesKilled++; hitBox.enabled = false; Destroy(ep); Destroy(this); Destroy(this.gameObject); } }
void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { Debug.Log("Hit!"); MovementPlayer mp = player.GetComponent <MovementPlayer>(); if (mp) { mp.Damage(bulletDamage); } Destroy(gameObject); } }
//务必在子类中初始化Spellname public override void Initialize() { base.Initialize(); poolManager = GameObject.Find("PoolManager").GetComponent <PoolManager>(); if (poolManager == null) { Debug.LogError("在" + spellName + "技能中,没有找到PoolManager脚本或物体!"); } movementComponent = player.GetComponent <MovementPlayer>(); if (movementComponent == null) { Debug.LogError("在" + spellName + "火球术技能中,没有找到movementComponent脚本或物体!"); } }
public override void Initialize() { base.Initialize(); movementComponent = player.GetComponent <MovementPlayer>(); BBVectorSize = (int)(blinkBackTime / blinkBackDetectTime); shadowParent = GameObject.Find("Shadows"); if (shadowParent == null) { Debug.LogError("在" + player.gameObject.name + "中,没有找到Shadows"); } shadow = GameObject.Find("Shadow"); if (shadowParent == null) { Debug.LogError("在" + player.gameObject.name + "中,没有找到Shadow"); } shadow.SetActive(false); playerAnim.SetSpell(this, SkillType.WindFire); }
/// <summary> /// 被击退函数 自定击退方向 /// </summary> /// <param name="attackerPos">攻击者</param> /// <param name="interruptTime">打断时间</param> /// <param name="interruptVector">击退力的方向</param> public void BeatBack(Transform attackerPos, float interruptTime, Vector2 interruptVector) { if (!isImmune) { //获取移动组件 //如果被打的是player if (gameObject.name == "Player") { MovementPlayer movement = gameObject.GetComponent <MovementPlayer>(); if (movement.RequestChangeControlStatus(interruptTime, MovementPlayer.PlayerControlStatus.Stun)) { if (transform.position.x > attackerPos.position.x) { movement.RequestMoveByTime(interruptVector, interruptTime, MovementPlayer.MovementMode.Attacked); } else { movement.RequestMoveByTime(-interruptVector, interruptTime, MovementPlayer.MovementMode.Attacked); } } } else { MovementEnemies movement = gameObject.GetComponent <MovementEnemies>(); if (movement.RequestChangeControlStatus(interruptTime, MovementEnemies.EnemyStatus.Stun)) { if (transform.position.x > attackerPos.position.x) { movement.RequestMoveByTime(interruptVector, interruptTime, MovementEnemies.MovementMode.Attacked); } else { movement.RequestMoveByTime(-interruptVector, interruptTime, MovementEnemies.MovementMode.Attacked); } } } } }
// 加载collider protected override void Awake() { base.Awake(); movementComponent = player.GetComponent <MovementPlayer>(); defenceComponent = player.GetComponent <DefencePlayer>(); }
private void Awake() { statusPlayer = GetComponent <StatusPlayer>(); movementPlayer = GetComponent <MovementPlayer>(); animatorPlayer = GetComponent <AnimatorPlayer>(); }
private void Start() { movementPlayer = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementPlayer>(); }
protected override void Awake() { base.Awake(); movementComponent = GetComponent <MovementPlayer>(); attackAnime = GetComponent <AttackAnime>(); }
public override void Initialize() { //获得场景物体引用 movementComponent = GetComponent <MovementPlayer>(); poolManager = GameObject.Find("PoolManager").GetComponent <PoolManager>(); //武器切换UI weaponChangePanel = GameObject.Find("WeaponChangePanel"); weaponChangeUI = weaponChangePanel.GetComponent <WeaponChangeUI>(); weaponChangePanel.SetActive(false); //初始化技能类 waterShieldSpell = new WaterShieldSpell(); waterShieldSpell.Initialize(); iceThunderSpell = new IceThunderSpell(); iceThunderSpell.Initialize(); iceShieldSpell = new IceShieldSpell(); iceShieldSpell.Initialize(); iceSwordSpell = new IceSwordSpell(); iceSwordSpell.Initialize(); iceHealSpell = new IceHealSpell(); iceHealSpell.Initialize(); iceHealSpell.Enable(); iceBlinkSpell = new IceBlinkSpell(); iceBlinkSpell.Initialize(); iceArrowSpell = new IceArrowSpell(); iceArrowSpell.Initialize(); iceHammerSpell = new IceHammerSpell(); iceHammerSpell.Initialize(); iceShotSpell = new IceShotSpell(); iceShotSpell.Initialize(); iceSheildMashSpell = new IceShieldMashSpell(); iceSheildMashSpell.Initialize(); //以下为碰墙检测参数的初始化 filter.useNormalAngle = false; filter.useDepth = false; filter.useOutsideDepth = false; filter.useOutsideNormalAngle = false; filter.useTriggers = false; filter.useLayerMask = true; LayerMask layerMask = 0; layerMask ^= 1 << LayerMask.NameToLayer("Water"); filter.layerMask = layerMask; //判断平台 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("移动端获取摇杆失败!"); } } }
public override void Initialize() { base.Initialize(); movement = player.GetComponent <MovementPlayer>(); //windThunderDamageArea = player.GetComponent<Collider2D>(); }
public void ButtonNotPressed() { MovementPlayer.ResetSpeed(); // сбрасываем скорость }
// Use this for initialization void Start() { mp = this.GetComponent <MovementPlayer>(); sac = this.GetComponent <SelectAnotherCharacter>(); hm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <HitManager>(); }
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(); } }
public override void Initialize() { base.Initialize(); movementComponent = player.GetComponent <MovementPlayer>(); }