Beispiel #1
0
        protected override void ActOnLiving(Vector3 dir, LivingHealthBehaviour healthBehaviour)
        {
            var ctc = healthBehaviour.connectionToClient;
            var rtt = healthBehaviour.RTT;
            var pos = healthBehaviour.GetComponent <RegisterTile>().WorldPositionServer;

            _ = AttackFleshRoutine(dir, healthBehaviour, null, pos, ctc, rtt);
        }
Beispiel #2
0
    /// Lists objects to be damaged on given tile. Prob should be moved elsewhere
    private bool HittingSomething(Vector3Int atPos, GameObject thrownBy, out List <LivingHealthBehaviour> victims)
    {
        //Not damaging anything at launch tile
        if (Vector3Int.RoundToInt(serverState.ActiveThrow.OriginPos) == atPos)
        {
            victims = null;
            return(false);
        }
        var objectsOnTile = MatrixManager.GetAt <LivingHealthBehaviour>(atPos);

        if (objectsOnTile != null)
        {
            var damageables = new List <LivingHealthBehaviour>();
            for (var i = 0; i < objectsOnTile.Count; i++)
            {
                LivingHealthBehaviour obj = objectsOnTile[i];
//Skip thrower for now
                if (obj.gameObject == thrownBy)
                {
                    Logger.Log($"{thrownBy.name} not hurting himself", Category.Throwing);
                    continue;
                }

                //Skip dead bodies
                if (obj.IsDead)
                {
                    continue;
                }

                var commonTransform = obj.GetComponent <IPushable>();
                if (commonTransform != null)
                {
                    if (this.ServerImpulse.To2Int() == commonTransform.ServerImpulse.To2Int() &&
                        this.SpeedServer <= commonTransform.SpeedServer)
                    {
                        Logger.LogTraceFormat("{0} not hitting {1} as they fly in the same direction", Category.Throwing, gameObject.name,
                                              obj.gameObject.name);
                        continue;
                    }
                }

                damageables.Add(obj);
            }

            if (damageables.Count > 0)
            {
                victims = damageables;
                return(true);
            }
        }

        victims = null;
        return(false);
    }