void OnCollisionEnter(Collision collision) { if (target == null) { target = collision.transform; print(target.name); } if (!excuted) { Vector3 cPoint = collision.transform.position; GameObject explode = Instantiate(HitFX, cPoint, Quaternion.identity) as GameObject; Destroy(explode, 2.0f); AttackCalFX aCal = Camera.mainCamera.GetComponent <AttackCalFX>(); if (fightBackMode) { aCal.fightBack = false; aCal.CriticalHit = false; aCal.SetAttackSequence(attacker, target.GetComponent <CharacterSelect>().getMapPosition()); } else { aCal.fightBack = true; aCal.CriticalHit = critiqHit; aCal.SetAttackSequence(attacker, target.GetComponent <CharacterSelect>().getMapPosition()); chessUI.Critical = critiqHit; chessUI.DelayFadeOut = true; chessUI.TargetFadeIn = false; } Destroy(transform.gameObject, 0.1f); excuted = true; } }
// Update is called once per frame void Update() { if (turningHead) { t += Time.deltaTime / timeToTurn; Vector3 relativePos = Target.transform.position - Attacker.transform.position; Quaternion rotation = Quaternion.LookRotation(relativePos); float yAngle = Mathf.LerpAngle(oldRotation.eulerAngles.y, rotation.eulerAngles.y, t); Attacker.transform.rotation = Quaternion.Euler(new Vector3(oldRotation.eulerAngles.x, yAngle, oldRotation.eulerAngles.z)); //update rotation network //networkView.RPC("UpdateRotation", RPCMode.Others, Attacker.name, oldRotation, rotation, t); float angle = Mathf.Abs(rotation.eulerAngles.y - yAngle); if (Mathf.RoundToInt(angle) == 360) { angle -= 360.0f; angle = Mathf.Abs(angle); } if (angle <= 1.0f) { t = 0.0f; turningHead = false; //start animating attacking if (attackMode) { if (attackerModel.GetComponent <AnimVault>() != null) { attackerModel.GetComponent <AnimVault>().CurrentState = AnimVault.AnimState.attack; if (attackerModel.GetComponent <AttackEvent>() != null) { attackerModel.GetComponent <AttackEvent>().SetTarget(Attacker, targetLocation, fightBackMode, critiqHit); } else if (attackerModel.GetComponent <ShowArrow>() != null) { attackerModel.GetComponent <ShowArrow>().SetTarget(Target, fightBackMode, critiqHit); } } else { AttackCalFX aCal = transform.GetComponent <AttackCalFX>(); if (fightBackMode) { aCal.fightBack = false; aCal.CriticalHit = false; aCal.SetAttackSequence(Attacker, targetLocation); } else { aCal.fightBack = true; aCal.CriticalHit = critiqHit; aCal.SetAttackSequence(Attacker, targetLocation); chessUI.Critical = critiqHit; chessUI.DelayFadeOut = true; chessUI.TargetFadeIn = false; } } } } } }
void ActivateAtk() { if (FightBackMode) { AttackCalFX atkCal = Camera.mainCamera.GetComponent <AttackCalFX>(); atkCal.fightBack = false; atkCal.CriticalHit = false; atkCal.SetAttackSequence(Chess, Sel); FightBackMode = false; } else { currentSelect = Camera.mainCamera.GetComponent <selection>(); currentSelect.AttackActivate(Chess, Sel); } }
void ActivateAtk() { AttackCalFX atkCal = Camera.mainCamera.GetComponent <AttackCalFX>(); if (fightBackMode) { atkCal.fightBack = false; atkCal.CriticalHit = false; atkCal.SetAttackSequence(Chess, Sel); } else { atkCal.fightBack = true; atkCal.CriticalHit = critiqHit; atkCal.SetAttackSequence(Chess, Sel); chessUI.Critical = critiqHit; chessUI.DelayFadeOut = true; chessUI.TargetFadeIn = false; } }
bool AttackCommand(Transform chess) { bool attackable = false; chess.GetComponent <CharacterSelect>().AttackRangeList.Clear(); Transform sel = decisions.GetAttackTarget(chess); if (sel != null) { AttackCalFX attackerCal = Camera.main.GetComponent <AttackCalFX>(); bool critiq = attackerCal.CalcriticalHit(chess, AttackType.physical); TurnHead th = Camera.main.GetComponent <TurnHead>(); th.SetTurnHeadSequence(chess, sel, true, false, critiq); attackable = true; } else { attackable = false; } return(attackable); }
// Use this for initialization void Start() { atkCal = transform.GetComponent <AttackCalFX>(); turningHead = transform.GetComponent <TurnHead>(); }
// Use this for initialization void Start() { atkCal = transform.GetComponent<AttackCalFX>(); turningHead = transform.GetComponent<TurnHead>(); }
// Use this for initialization void Start() { atkCal = transform.GetComponent <AttackCalFX>(); }