Пример #1
0
    // Use this for initialization
    protected override void Start()
    {
        base.Start();
        core = GetComponent <CharacterCore>();


        InitWeapon();
    }
Пример #2
0
 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);
 }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        agent       = GetComponent <NavMeshAgent>();
        seeker      = GetComponent <SeekingTarget>();
        core        = GetComponent <CharacterCore>();
        agent.speed = core.movementSpeed;

        seeker.SeedTarget += NewTarget;
    }
Пример #5
0
        private void Init(CharacterCore attacker, Transform origin)
        {
            _attacker = attacker;
            var trans = transform;

            trans.position = origin.position;
            trans.rotation = origin.rotation;
            _destroyTime   = 0;
        }
Пример #6
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!");
 }
Пример #7
0
    // 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;
    }
Пример #8
0
 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;
     }
 }
Пример #9
0
    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();
        }
    }
Пример #10
0
        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);
            }
        }
Пример #11
0
        /// <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);
        }
Пример #12
0
        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);
        }
Пример #13
0
        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;
        }
Пример #14
0
 private void Awake()
 {
     Instance = this;
 }
Пример #15
0
 // Public
 protected override void HitCharacterEnter(CharacterCore other)
 {
     Destroy(this.gameObject);
     Instantiate(hitParticle, other.transform);
 }
Пример #16
0
 public override void OnAttachStatus(CharacterCore character)
 {
 }
Пример #17
0
 private void Awake()
 {
     _transformCache = transform;
     Core            = GetComponent <CharacterCore>();
 }
 public CharacterAttacker(CharacterCore attacker)
 {
     Attacker = attacker;
 }
Пример #19
0
 public virtual void OnDetachStatus(CharacterCore character)
 {
 }
 public StatusAttacker(CharacterCore owner, IStatusChange attacker)
 {
     StatusOwner = owner;
     Attacker    = attacker;
 }
Пример #21
0
 protected virtual void HitCharacterStay(CharacterCore other)
 {
 }
Пример #22
0
 protected virtual void HitCharacterEnter(CharacterCore other)
 {
 }
Пример #23
0
 public virtual void OnUpdateStatus(CharacterCore character)
 {
     RemainingTime.Value -= Time.deltaTime;
 }
Пример #24
0
 protected override void HitCharacterEnter(CharacterCore other)
 {
     Instantiate(hitParticle, other.transform);
     Active = false;
 }
Пример #25
0
 public WorldCore(int characters, BaseTuningParams tuning)
 {
     CharacterCores = new CharacterCore[characters];
     Tuning         = tuning;
 }
 private void Awake()
 {
     _core = GetComponent <CharacterCore>();
 }