コード例 #1
0
        public void FireShot(ShotInfo shot)
        {
            shot.CreateTimeStamp = GameTime.Now;

            MsgShotBegin shotMessage = new MsgShotBegin();

            if (shot.Owner == null)
            {
                shotMessage.PlayerID = BZFlag.Data.Players.PlayerConstants.ServerPlayerID;
            }
            else
            {
                shotMessage.PlayerID = shot.Owner.PlayerID;
            }

            shotMessage.ShotID   = shot.PlayerShotID;
            shotMessage.Team     = shot.TeamColor;
            shotMessage.TimeSent = (float)shot.FireTimestamp;
            shotMessage.Position = shot.InitalPostion;
            shotMessage.Velocity = shot.InitalVector;
            shotMessage.Lifetime = (float)shot.Lifetime;
            if (shot.SourceFlag != null)
            {
                shotMessage.Flag = shot.SourceFlag.FlagAbbv;
            }

            lock (ShotList)
                ShotList.Add(shot);

            Players.SendToAll(shotMessage, false);

            ShotFired?.Invoke(this, shot);
            shot.Allow = true;
        }
コード例 #2
0
        public void HandleShotBegin(ServerPlayer sender, MsgShotBegin shotMessage)
        {
            ShotInfo shot = new ShotInfo();

            shot.GlobalID     = NewShotID();
            shot.Owner        = sender;
            shot.PlayerShotID = shotMessage.ShotID;
            shot.Allow        = true;

            if (sender.Info.CariedFlag == null)
            {
                shot.ShotType   = GetDefaultShotType(sender);
                shot.SourceFlag = null;
            }
            else
            {
                shot.ShotType   = sender.Info.CariedFlag.Flag.FlagShot;
                shot.SourceFlag = sender.Info.CariedFlag.Flag;
            }

            shot.InitalPostion = shotMessage.Position;
            shot.InitalVector  = shotMessage.Velocity;
            shot.FireTimestamp = shotMessage.TimeSent;
            shot.TeamColor     = sender.ActualTeam;
            shot.Lifetime      = shotMessage.Lifetime;

            ShotPreFire?.Invoke(this, shot);

            if (shot.Allow)
            {
                FireShot(shot);
            }
        }
コード例 #3
0
        public void FireShot(float range, Ray ray)
        {
            var hitLocation  = ray.origin + ray.direction * range;
            var hitSomething = false;
            var entityId     = 0L;

            if (Physics.Raycast(ray, out var hit, range, shootingLayerMask))
            {
                hitSomething = true;
                hitLocation  = hit.point;
                var spatialEntity = hit.transform.root.GetComponent <SpatialOSComponent>();
                if (spatialEntity != null)
                {
                    entityId = spatialEntity.SpatialEntityId.Id;
                }
            }

            var shotInfo = new ShotInfo()
            {
                EntityId     = entityId,
                HitSomething = hitSomething,
                HitLocation  = (hitLocation - spatial.Worker.Origin).ToIntAbsolute(),
                HitOrigin    = (ray.origin - spatial.Worker.Origin).ToIntAbsolute()
            };

            shooting.SendShots(shotInfo);
        }
コード例 #4
0
        public void HandleShotEnd(ServerPlayer sender, MsgShotEnd shotMessage)
        {
            ShotInfo shot = FindShot(shotMessage.PlayerID, shotMessage.ShotID);

            if (shot == null)
            {
                return;
            }

            bool valid = false;

            if (sender.Info.ShotImmunities > 0)
            {
                sender.Info.ShotImmunities--;
                valid = true;
            }

            if (shot.ShotType == ShotTypes.ThiefShot || shot.ShotType == ShotTypes.GuidedShot)
            {
                valid = true;
            }

            if (!valid)     // don't penalize them for sending this, they just always send it
            {
                return;     // we know that all other cases must be followed by a death to be valid, so just remove the shot then.
            }
            Flags.HandlePlayerTakeHit(sender, shot.Owner, shot);

            ShotHit?.Invoke(this, shot);
            EndShot(shot, shotMessage.Exploded);
        }
コード例 #5
0
        public bool IsShotAvailable(GenericShip targetShip)
        {
            bool result = true;

            int minRange = WeaponInfo.MinRange;
            int maxRange = WeaponInfo.MaxRange;

            HostShip.CallUpdateWeaponRange(this, ref minRange, ref maxRange, targetShip);

            ShotInfo shotInfo = new ShotInfo(HostShip, targetShip, this);

            if (!shotInfo.IsShotAvailable)
            {
                return(false);
            }

            if (shotInfo.Range < minRange)
            {
                return(false);
            }
            if (shotInfo.Range > maxRange)
            {
                return(false);
            }

            return(result);
        }
コード例 #6
0
ファイル: DeathCod.cs プロジェクト: rje/cod-of-duty
 void OnShotBy(ShotInfo si)
 {
     m_hp -= si.m_damage;
     if(m_hp <= 0 && !m_dead) {
         Die();
     }
 }
コード例 #7
0
ファイル: Rey.cs プロジェクト: shawks-sonifi/FlyCasual
            public override bool IsActionEffectAvailable()
            {
                bool result = false;

                switch (Combat.AttackStep)
                {
                case CombatStep.Attack:
                    if (Combat.ShotInfo.InArc)
                    {
                        result = true;
                    }
                    break;

                case CombatStep.Defence:
                    ShotInfo shotInfo = new ShotInfo(Combat.Defender, Combat.Attacker, Combat.Defender.PrimaryWeapon);
                    if (shotInfo.InArc)
                    {
                        result = true;
                    }
                    break;

                default:
                    break;
                }

                return(result);
            }
コード例 #8
0
ファイル: IG88A.cs プロジェクト: jychuah/FlyCasual
        private int GetThreatLevelForShip(GenericShip ship, List <GenericShip> enemiesAtRangeOne, List <GenericShip> enemiesAtRangeTwo, List <GenericShip> enemiesAtRangeThree)
        {
            int shipThreatLevel = 0;

            foreach (GenericShip enemyShip in enemiesAtRangeOne)
            {
                ShotInfo shotInfo = new ShotInfo(enemyShip, HostShip, enemyShip.PrimaryWeapons);
                if (shotInfo.IsShotAvailable)
                {
                    shipThreatLevel += (enemyShip.State.Firepower + 1) * 10;
                }
            }

            foreach (GenericShip enemyShip in enemiesAtRangeTwo)
            {
                ShotInfo shotInfo = new ShotInfo(enemyShip, HostShip, enemyShip.PrimaryWeapons);
                if (shotInfo.IsShotAvailable)
                {
                    shipThreatLevel += enemyShip.State.Firepower * 10;
                }
            }

            foreach (GenericShip enemyShip in enemiesAtRangeThree)
            {
                ShotInfo shotInfo = new ShotInfo(enemyShip, HostShip, enemyShip.PrimaryWeapons);
                if (shotInfo.IsShotAvailable)
                {
                    shipThreatLevel += enemyShip.State.Firepower * 7;
                }
            }
            return(shipThreatLevel);
        }
コード例 #9
0
        public override bool IsDiceModificationAvailable()
        {
            bool result = false;

            switch (Combat.AttackStep)
            {
            case CombatStep.Attack:
                if ((Combat.ChosenWeapon.GetType() == typeof(PrimaryWeaponClass)) && (Combat.ShotInfo.InArc))
                {
                    result = true;
                }
                break;

            case CombatStep.Defence:
                ShotInfo shotInfo = new ShotInfo(Combat.Defender, Combat.Attacker, Combat.Defender.PrimaryWeapon);
                if (shotInfo.InArc)
                {
                    result = true;
                }
                break;

            default:
                break;
            }

            return(result);
        }
コード例 #10
0
        private int GetFriednlyShipAiPriority(GenericShip ship)
        {
            int priority = ship.PilotInfo.Cost;

            DistanceInfo distInfo = new DistanceInfo(ship, LockedShip);

            if (distInfo.Range < 4)
            {
                priority += 100;
            }

            ShotInfo shotInfo = new ShotInfo(ship, LockedShip, ship.PrimaryWeapons);

            if (shotInfo.IsShotAvailable)
            {
                priority += 50;
            }

            if (!ship.Tokens.HasToken <BlueTargetLockToken>('*'))
            {
                priority += 100;
            }

            return(priority);
        }
コード例 #11
0
ファイル: Tutorial.cs プロジェクト: DailySoccer/DisneyKicks
 void RecordTarget(ShotInfo _info)
 {
     if (isActive)
     {
         hide = false;
     }
 }
コード例 #12
0
ファイル: GenericAbility.cs プロジェクト: vitreuz/FlyCasual
        public bool FilterTargetsByParameters(GenericShip ship, int minRange, int maxRange, ArcType arcType, TargetTypes targetTypes, Type tokenType = null)
        {
            bool result = true;

            if ((Phases.CurrentSubPhase as SelectShipSubPhase) == null || (Phases.CurrentSubPhase as SelectShipSubPhase).CanMeasureRangeBeforeSelection)
            {
                if (!Tools.CheckShipsTeam(ship, hostShip, targetTypes))
                {
                    return(false);
                }

                if (tokenType != null && !ship.Tokens.HasToken(tokenType, '*'))
                {
                    return(false);
                }

                ShotInfo shotInfo = new ShotInfo(hostShip, ship, hostShip.PrimaryWeapons);
                if (arcType != ArcType.None && !shotInfo.InArcByType(arcType))
                {
                    return(false);
                }
                if (shotInfo.Range < minRange)
                {
                    return(false);
                }
                if (shotInfo.Range > maxRange)
                {
                    return(false);
                }
            }

            return(result);
        }
コード例 #13
0
ファイル: Combat.cs プロジェクト: JeffSkyrunner/FlyCasual
    // CHECK AVAILABLE WEAPONS TO ATTACK THIS TARGET

    private static void SelectWeapon()
    {
        List <IShipWeapon> weapons = GetAvailbleAttackTypes(Selection.ThisShip, Selection.AnotherShip);

        if (weapons.Count > 1)
        {
            Phases.StartTemporarySubPhaseOld(
                "Choose a weapon for this attack.",
                typeof(WeaponSelectionDecisionSubPhase),
                delegate { TryPerformAttack(isSilent: false); }
                );
        }
        else if (weapons.Count == 1)
        {
            Combat.ChosenWeapon = weapons.First();
            Messages.ShowInfo("Attacking with " + Combat.ChosenWeapon.Name);

            Combat.ShotInfo = new ShotInfo(Selection.ThisShip, Selection.AnotherShip, Combat.ChosenWeapon);

            TryPerformAttack(isSilent: false);
        }
        else
        {
            // Messages.ShowError("Error: No weapon to use");
            TryPerformAttack(isSilent: false);
        }
    }
コード例 #14
0
ファイル: Combat.cs プロジェクト: JeffSkyrunner/FlyCasual
    public static void DeclareIntentToAttack(int attackerId, int defenderId, bool weaponIsAlreadySelected = false)
    {
        Phases.CurrentSubPhase.IsReadyForCommands = false;

        UI.HideContextMenu();
        UI.HideSkipButton();

        Selection.ChangeActiveShip("ShipId:" + attackerId);
        Selection.ChangeAnotherShip("ShipId:" + defenderId);

        Action callback = Phases.CurrentSubPhase.CallBack;
        var    subphase = Phases.StartTemporarySubPhaseNew(
            "Extra Attack",
            typeof(AttackExecutionSubphase),
            delegate {
            Phases.FinishSubPhase(typeof(AttackExecutionSubphase));
            callback();
        }
            );

        subphase.Start();

        if (!weaponIsAlreadySelected)
        {
            SelectWeapon();
        }
        else
        {
            ShotInfo = new ShotInfo(Selection.ThisShip, Selection.AnotherShip, ChosenWeapon);
            TryPerformAttack(isSilent: true);
        }
    }
コード例 #15
0
            private bool AnotherTargetsPresent()
            {
                bool result = false;

                foreach (var ship in OriginalDefender.Owner.Ships.Values)
                {
                    if (ship.ShipId == OriginalDefender.ShipId)
                    {
                        continue;
                    }

                    DistanceInfo distInfo = new DistanceInfo(ship, OriginalDefender);
                    if (distInfo.Range > 1)
                    {
                        continue;
                    }

                    ShotInfo shotInfo = new ShotInfo(HostShip, ship, HostUpgrade as IShipWeapon);
                    if (shotInfo.IsShotAvailable)
                    {
                        return(true);
                    }
                }

                return(result);
            }
コード例 #16
0
        /// <summary>
        /// Returns true if we don't already have a target that is in range and locked, and we have targets available.
        /// </summary>
        public static bool HasValidLockTargetsAndNoLockOnShipInRange(GenericShip ship, int minRange = 1, int maxRange = 3)
        {
            var validTargetLockedAlready = false;
            var numTargetLockTargets     = 0;

            foreach (var anotherShip in Roster.GetPlayer(Roster.AnotherPlayer(ship.Owner.PlayerNo)).Ships)
            {
                ShotInfo shotInfo = new ShotInfo(ship, anotherShip.Value, ship.PrimaryWeapons);
                if (shotInfo.Range >= minRange && shotInfo.Range <= maxRange && shotInfo.IsShotAvailable)
                {
                    if (!ActionsHolder.HasTargetLockOn(ship, anotherShip.Value))
                    {
                        // We have a target in range that doesn't have a target lock on it from us.
                        numTargetLockTargets++;
                    }
                    else
                    {
                        // We already have a target in range that has our target lock on it.
                        validTargetLockedAlready = true;
                    }
                }
            }

            return(validTargetLockedAlready == false && numTargetLockTargets > 0);
        }
コード例 #17
0
    public void AddCloneInfo()
    {
        ShotInfo info = CloneShotInfo();

        presetDatabase.AddShotInfo(presetList.value, info);
        CreateMarker(info);
    }
コード例 #18
0
        public override bool ReinforcePostCombatEffectCanBeUsed(ArcFacing facing)
        {
            if (Combat.DiceRollAttack.Successes <= 1)
            {
                return(false);
            }

            bool result = false;

            List <GenericArc> savedArcs = Combat.Defender.ArcInfo.Arcs;

            Combat.Defender.ArcInfo.Arcs = new List <GenericArc>()
            {
                new ArcSpecial180(Combat.Defender.ShipBase)
            };
            ShotInfo reverseShotInfo = new ShotInfo(Combat.Defender, Combat.Attacker, Combat.Defender.PrimaryWeapon);
            bool     inForward180Arc = reverseShotInfo.InArc;

            Combat.Defender.ArcInfo.Arcs = new List <GenericArc>()
            {
                new ArcSpecial180Rear(Combat.Defender.ShipBase)
            };
            reverseShotInfo = new ShotInfo(Combat.Defender, Combat.Attacker, Combat.Defender.PrimaryWeapon);
            bool inRear180Arc = reverseShotInfo.InArc;

            Combat.Defender.ArcInfo.Arcs = savedArcs;

            result = (facing == ArcFacing.Front180) ? inForward180Arc && !inRear180Arc : !inForward180Arc && inRear180Arc;

            return(result);
        }
コード例 #19
0
        private static void ProcessHeavyGeometryCalculations(GenericShip ship, out float minDistanceToEnemyShip, out float minDistanceToNearestEnemyInShotRange, out float minAngle, out int enemiesInShotRange)
        {
            minDistanceToEnemyShip = float.MaxValue;
            minDistanceToNearestEnemyInShotRange = 0;
            minAngle           = float.MaxValue;
            enemiesInShotRange = 0;
            foreach (GenericShip enemyShip in ship.Owner.EnemyShips.Values)
            {
                DistanceInfo distInfo = new DistanceInfo(ship, enemyShip);
                if (distInfo.MinDistance.DistanceReal < minDistanceToEnemyShip)
                {
                    minDistanceToEnemyShip = distInfo.MinDistance.DistanceReal;
                }

                ShotInfo shotInfo = new ShotInfo(ship, enemyShip, ship.PrimaryWeapons.First());
                if (shotInfo.IsShotAvailable)
                {
                    enemiesInShotRange++;

                    if (minDistanceToNearestEnemyInShotRange < shotInfo.DistanceReal)
                    {
                        minDistanceToNearestEnemyInShotRange = shotInfo.DistanceReal;
                    }
                }

                Vector3 forward     = ship.GetFrontFacing();
                Vector3 toEnemyShip = enemyShip.GetCenter() - ship.GetCenter();
                float   angle       = Mathf.Abs(Vector3.SignedAngle(forward, toEnemyShip, Vector3.down));
                if (angle < minAngle)
                {
                    minAngle = angle;
                }
            }
        }
コード例 #20
0
        private void AssignFocusTokensToTarget()
        {
            // Count ships in arc of Jyn Erso's ship...
            var tokenCount = Roster.AllShips.Values
                             .Where(s => s.Owner.Id != HostShip.Owner.Id)
                             .Where(s =>
            {
                ShotInfo arcInfo = new ShotInfo(HostShip, s, HostShip.PrimaryWeapon);
                return(arcInfo.InArc && arcInfo.Range <= 3);
            })
                             .Count();

            // ... to a maximum of 3...
            tokenCount = Math.Min(tokenCount, 3);

            // ... and assign that many focus tokens to the selected ship
            Messages.ShowInfo(string.Format("{0} assigns {1} focus {3} to {2}.", HostUpgrade.Name, tokenCount, TargetShip.PilotName, tokenCount == 1 ? "token" : "tokens"));
            if (tokenCount > 0)
            {
                // Assign the tokens
                RegisterAssignMultipleFocusTokens(tokenCount);
                // Jyn says something
                var clip = new[] { "JynErso1", "JynErso2", "JynErso3", "JynErso4", "JynErso5" }[UnityEngine.Random.Range(0, 5)];
                Sounds.PlayShipSound(clip);
            }
        }
コード例 #21
0
        private int GetTargetLockAiPriority(GenericShip ship)
        {
            int result = 0;

            if (ship.Owner.PlayerNo != Selection.ThisShip.Owner.PlayerNo)
            {
                ShotInfo shotInfo = new ShotInfo(Selection.ThisShip, ship, Selection.ThisShip.PrimaryWeapons);
                if (shotInfo.IsShotAvailable)
                {
                    result += 1000;
                }
                if (!ship.ShipsBumped.Contains(Selection.ThisShip))
                {
                    result += 500;
                }
                if (shotInfo.Range <= 3)
                {
                    result += 250;
                }

                result += ship.PilotInfo.Cost + ship.UpgradeBar.GetUpgradesOnlyFaceup().Sum(n => n.UpgradeInfo.Cost);
            }

            return(result);
        }
        public void FireShot(float range, Ray ray)
        {
            var      hitLocation  = ray.origin + ray.direction * range;
            var      hitSomething = false;
            EntityId entityId     = new EntityId(0);

            if (Physics.Raycast(ray, out var hit, range, shootingLayerMask))
            {
                hitSomething = true;
                hitLocation  = hit.point;
                var spatialEntity = hit.transform.root.GetComponent <LinkedEntityComponent>();
                if (spatialEntity != null)
                {
                    entityId = spatialEntity.EntityId;
                }
            }

            var shotInfo = new ShotInfo()
            {
                EntityId     = entityId,
                HitSomething = hitSomething,
                HitLocation  = (hitLocation - workerOrigin).ToVector3Int(),
                HitOrigin    = (ray.origin - workerOrigin).ToVector3Int(),
            };

            shooting.SendShotsEvent(shotInfo);
        }
コード例 #23
0
        public bool IsShotAvailable(GenericShip targetShip)
        {
            bool result = true;

            int range;

            ShotInfo shotInfo = new ShotInfo(Host, targetShip, this);

            range = shotInfo.Range;
            if (!CanShootOutsideArc)
            {
                if (!shotInfo.IsShotAvailable)
                {
                    return(false);
                }
            }

            if (range < MinRange)
            {
                return(false);
            }
            if (range > MaxRange)
            {
                return(false);
            }

            return(result);
        }
コード例 #24
0
    public void UISync()
    {
        if (!SelectMarkerExistsCheck())
        {
            Debug.Log("select is null");
            return;
        }

        UIActive(true);

        ShotInfo info = GetCurrInfo();

        scriptChange = true;

        bulletGroupUI.value = info.bulletGroup;
        bulletListUI.value  = info.bulletIndex;

        scriptChange = false;

        speedUI.text        = info.speed.ToString();
        attackUI.text       = info.attack.ToString();
        angleUI.text        = info.angle.ToString();
        lifeTimeUI.text     = info.lifeTime.ToString();
        angleAccelUI.text   = info.angleAccel.ToString();
        speedAccelUI.text   = info.speedAccel.ToString();
        penetrateUI.isOn    = info.penetrate;
        rotationLockUI.isOn = info.rotationLock;
        guidedUI.isOn       = info.guided;
    }
コード例 #25
0
        public override bool AnotherShipCanBeSelected(GenericShip targetShip, int mouseKeyIsPressed)
        {
            bool result = false;

            if (Roster.GetPlayer(RequiredPlayer).GetType() != typeof(Players.NetworkOpponentPlayer))
            {
                if (Selection.ThisShip != null)
                {
                    if (targetShip.Owner.PlayerNo != Phases.CurrentSubPhase.RequiredPlayer)
                    {
                        ShotInfo shotInfo = new ShotInfo(Selection.ThisShip, targetShip, Selection.ThisShip.PrimaryWeapon);
                        MovementTemplates.ShowFiringArcRange(shotInfo);
                        result = true;
                    }
                    else
                    {
                        Messages.ShowErrorToHuman("Ship cannot be selected as attack target: Friendly ship");
                    }
                }
                else
                {
                    Messages.ShowErrorToHuman("Ship cannot be selected as attack target:\nFirst select attacker");
                }
            }
            return(result);
        }
コード例 #26
0
ファイル: Actions.cs プロジェクト: GeneralVryth/FlyCasual
    public static int CountEnemiesTargeting(GenericShip thisShip, int direction = 0)
    {
        int result = 0;

        foreach (var anotherShip in Roster.GetPlayer(Roster.AnotherPlayer(thisShip.Owner.PlayerNo)).Ships.Values)
        {
            ShotInfo shotInfo = new ShotInfo(anotherShip, thisShip, anotherShip.PrimaryWeapons);
            if ((shotInfo.Range < 4) && (shotInfo.IsShotAvailable))
            {
                if (direction == 0)
                {
                    result++;
                }
                else
                {
                    if (direction == 1)
                    {
                        if (thisShip.SectorsInfo.IsShipInSector(anotherShip, Arcs.ArcType.FullFront))
                        {
                            result++;
                        }
                    }
                    else if (direction == -1)
                    {
                        if (thisShip.SectorsInfo.IsShipInSector(anotherShip, Arcs.ArcType.FullRear))
                        {
                            result++;
                        }
                    }
                }
            }
        }

        return(result);
    }
コード例 #27
0
        private void SelectSpacetugTarget()
        {
            ShotInfo shotInfo = new ShotInfo(SpacetugOwner, TargetShip, SpacetugOwner.PrimaryWeapons);

            if (shotInfo.InArc && shotInfo.Range == 1)
            {
                SelectShipSubPhase.FinishSelectionNoCallback();

                MovementTemplates.ReturnRangeRuler();

                Messages.ShowInfo("Spacetug Tractor Array: " + SpacetugOwner.PilotInfo.PilotName + " has assigned a Tractor Beam token to " + TargetShip.PilotInfo.PilotName);

                TractorBeamToken token = new TractorBeamToken(TargetShip, SpacetugOwner.Owner);

                if (SpacetugOwner.SectorsInfo.IsShipInSector(TargetShip, Arcs.ArcType.Bullseye) && SpacetugOwner.SectorsInfo.RangeToShipBySector(TargetShip, Arcs.ArcType.Bullseye) == 1)
                {
                    TargetShip.Tokens.AssignToken(token, AssignSecondTractorBeamToken);
                }
                else
                {
                    TargetShip.Tokens.AssignToken(token, CallBack);
                }
            }
            else
            {
                RevertSubPhase();
            }
        }
コード例 #28
0
        public bool InPrimaryWeaponFireZone(GenericShip anotherShip, int minRange = 1, int maxRange = 3)
        {
            bool     result   = true;
            ShotInfo shotInfo = new ShotInfo(this, anotherShip, PrimaryWeapons);

            result = InPrimaryWeaponFireZone(shotInfo.Range, shotInfo.InPrimaryArc, minRange, maxRange);
            return(result);
        }
コード例 #29
0
        public bool InPrimaryWeaponFireZone(GenericShip anotherShip)
        {
            bool     result   = true;
            ShotInfo shotInfo = new ShotInfo(this, anotherShip, PrimaryWeapon);

            result = InPrimaryWeaponFireZone(shotInfo.Range, shotInfo.InPrimaryArc);
            return(result);
        }
コード例 #30
0
 public void OnShotExecuted(ShotInfo shotInfo)
 {
     lastShot = shotInfo;
     if (ShotExecuted != null)
     {
         ShotExecuted(shotInfo);
     }
 }
コード例 #31
0
 void OnShotBy(ShotInfo si)
 {
     m_hp -= si.m_damage;
     if (m_hp <= 0 && !m_dead)
     {
         Die();
     }
 }
コード例 #32
0
ファイル: Cod.cs プロジェクト: OneGameAMonth/cod-of-duty
    void OnShotBy(ShotInfo si)
    {
        var level = GameObject.FindGameObjectWithTag("Level").GetComponent<LevelInit>();
        level.RemoveFish(gameObject);
        foreach(var emitter in m_emitters) {
            emitter.Emit (Random.Range (30, 60));
            emitter.transform.parent = null;
            GameObject.Destroy (emitter.gameObject, 2.5f);
        }
        m_barrel.RemoveFish(gameObject);

        GenerateLoot();

        Destroy (gameObject);
    }
コード例 #33
0
ファイル: Player.cs プロジェクト: OneGameAMonth/cod-of-duty
 void OnShotBy(ShotInfo si)
 {
     m_hp -= si.m_damage;
     m_hp = Mathf.Clamp (m_hp, 0, m_maxHP);
     m_sinceLastShot = 0;
     AudioSource.PlayClipAtPoint(m_hurtClip, transform.position);
     if(m_hp == 0 && !m_isDead) {
         Die(si.m_shooter);
     }
 }
コード例 #34
0
 void OnShotBy(ShotInfo si)
 {
     m_hp -= si.m_damage;
     m_blood.transform.position = si.m_location;
     m_blood.Emit (30);
 }
コード例 #35
0
 public void ShotBy(GameObject go, Vector3 location, int damage)
 {
     var info = new ShotInfo(go, location, damage);
     m_messageTarget.SendMessage("OnShotBy", info, SendMessageOptions.RequireReceiver);
 }