// Use this for initialization protected override void Start() { base.Start(); core = GetComponent <CharacterCore>(); InitWeapon(); }
protected void HitCharacter(AttachableHitbox user, CharacterCore receiver) { // Apply damage ShowFloatingText(receiver.transform, preset.Damage); receiver.TakeDamage(preset.Damage); user.Character.GetComponent <CharacterCore>().ApplyHitstun(preset.HitstunDuration); receiver.ApplyHitstun(preset.HitstunDuration); }
public static bool IsAbleAttack(this CharacterCore from, CharacterCore to) { if (!from || !to) { return(false); } return(from.Alliance != to.Alliance); }
// Use this for initialization void Start() { agent = GetComponent <NavMeshAgent>(); seeker = GetComponent <SeekingTarget>(); core = GetComponent <CharacterCore>(); agent.speed = core.movementSpeed; seeker.SeedTarget += NewTarget; }
private void Init(CharacterCore attacker, Transform origin) { _attacker = attacker; var trans = transform; trans.position = origin.position; trans.rotation = origin.rotation; _destroyTime = 0; }
protected void HitCharacter(DetachableHitbox user, CharacterCore receiver) { // Apply damage ShowFloatingText(receiver.transform, preset.Damage); receiver.TakeDamage(preset.Damage); receiver.ApplyHitstun(preset.HitstunDuration); receiver.GetComponent <CharacterMover>().SetVelocity(Vector2.up * preset.KnockupVelocity); Debug.Log("Hit character!"); }
// Use this for initialization void Start() { core = GetComponent <CharacterCore>(); animator = GetComponentInChildren <Animator>(); personRigidbody = GetComponent <Rigidbody>(); combatController = GetComponent <PlayerCombatController>(); cam = Camera.main.transform; lookDir = Vector3.forward; }
protected void HitCharacter(AttachableHitbox triggerer, CharacterCore receiver) { elapsedHitTime += Time.deltaTime; if (elapsedHitTime > preset.LaserTickDuration) { float damage = Mathf.Lerp(preset.MinLaserDamage, preset.MaxLaserDamage, elapsedChargeTime / Mathf.Lerp(preset.MinLaserDuration, preset.MaxLaserDuration, elapsedChargeTime / preset.MaxChargeTime)); ShowFloatingText(receiver.transform, damage); receiver.TakeDamage(damage); elapsedHitTime = 0f; } }
private void OnTriggerStay2D(Collider2D collision) { if (!Active || !StayActive) { return; } if (ReferenceEquals(User, collision.gameObject)) // If I collided with the user, ignore { return; } bool successfulHit = false; if (attachedHitboxLayer.Contains(collision.gameObject)) { AttachableHitbox other = collision.GetComponent <AttachableHitbox>(); OnHitAttachableHitboxStay?.Invoke((T)this, other); HitAttachableHitboxStay(other); successfulHit = true; } else if (detachedHitboxLayer.Contains(collision.gameObject)) { DetachableHitbox other = collision.GetComponent <DetachableHitbox>(); if (GetInstanceID() > other.GetInstanceID()) { OnHitDetachableHitboxStay?.Invoke((T)this, other); // Apply Destroy() within the Effect HitDetachableHitboxStay(other); successfulHit = true; } } else if (characterLayer.Contains(collision.gameObject)) { CharacterCore other = collision.GetComponent <CharacterCore>(); OnHitCharacterStay?.Invoke((T)this, other); HitCharacterStay(other); successfulHit = true; } else if (groundLayer.Contains(collision.gameObject)) { OnHitGroundStay?.Invoke((T)this); HitGroundStay(); successfulHit = true; } // General behaviour if (successfulHit) { HitAnythingStay(); } }
public override void OnUpdateStatus(CharacterCore character) { base.OnUpdateStatus(character); var interval = 1.0f; if (startTime - interval > RemainingTime.Value) { startTime -= interval; character.ApplyDamage(new StatusAttacker(character, this), 10); } }
/// <summary> /// ターゲットとの間に障害物があるか調べる /// </summary> /// <returns></returns> public static bool HasObstacleBetweenTarget(CharacterCore enemy, CharacterCore target) { if (target.CharacterArm.EquippedArm == null) { return(false); } var enemyPos = enemy.CharacterArm.EquippedArm.GetBody().transform.position; var targetPos = target.CharacterArm.EquippedArm.GetBody().transform.position; RaycastHit hitInfo; var hit = Physics.Linecast(enemyPos, targetPos, out hitInfo, ~LayerMask.GetMask("Player", "Enemy", "Bullet")); if (hit) { Debug.Log("hit : " + hitInfo.collider.name); } return(hit); }
public Character(BasePlayer player, Vector2 spawnPos) : base(1) { HitObjects = new List <Entity>(); Weapons = new WeaponStat[(int)Weapon.NUM_WEAPONS]; NinjaStat = new NinjaStat(); ActiveWeapon = Weapon.GUN; LastWeapon = Weapon.HAMMER; QueuedWeapon = (Weapon)(-1); Position = spawnPos; Health = 0; Armor = 0; EmoteStopTick = -1; LastAction = -1; Player = player; IsAlive = true; Input = new SnapObj_PlayerInput(); LatestPrevInput = new SnapObj_PlayerInput(); LatestInput = new SnapObj_PlayerInput(); Core = new CharacterCore(); SendCore = new CharacterCore(); ReckoningCore = new CharacterCore(); Core.Reset(); Core.Init(GameWorld.WorldCore, GameContext.Collision); Core.Position = Position; var worldCore = new WorldCore( GameWorld.WorldCore.CharacterCores.Length, GameWorld.WorldCore.Tuning); ReckoningCore.Init(worldCore, GameContext.Collision); GameWorld.WorldCore.CharacterCores[player.ClientId] = Core; GameContext.GameController.OnCharacterSpawn(this); }
public void SetOwner(CharacterCore character) { if (characterCore == character) { return; } //装備したときはキャラクターの色で光らせる if (character) { _themeColor = character.ThemeColor; CoreObject.layer = character.gameObject.layer; } else { CoreObject.layer = LayerMask.NameToLayer("Weapon"); } StartCoroutine(LightFadeAnim(character)); characterCore = character; _isReserved = false; }
private void Awake() { Instance = this; }
// Public protected override void HitCharacterEnter(CharacterCore other) { Destroy(this.gameObject); Instantiate(hitParticle, other.transform); }
public override void OnAttachStatus(CharacterCore character) { }
private void Awake() { _transformCache = transform; Core = GetComponent <CharacterCore>(); }
public CharacterAttacker(CharacterCore attacker) { Attacker = attacker; }
public virtual void OnDetachStatus(CharacterCore character) { }
public StatusAttacker(CharacterCore owner, IStatusChange attacker) { StatusOwner = owner; Attacker = attacker; }
protected virtual void HitCharacterStay(CharacterCore other) { }
protected virtual void HitCharacterEnter(CharacterCore other) { }
public virtual void OnUpdateStatus(CharacterCore character) { RemainingTime.Value -= Time.deltaTime; }
protected override void HitCharacterEnter(CharacterCore other) { Instantiate(hitParticle, other.transform); Active = false; }
public WorldCore(int characters, BaseTuningParams tuning) { CharacterCores = new CharacterCore[characters]; Tuning = tuning; }
private void Awake() { _core = GetComponent <CharacterCore>(); }