Exemplo n.º 1
0
        internal void Die(bool callPartsChanged = true)
        {
            Health  = 0;
            MyState = State.DESTROYED;
            Color   = Aircraft.ControlledByPlayer ? CCColor3B.DarkGray : PlaneToDeathColor(((PlayLayer)Layer).CurrentPlaneColor);
            // reduce your mass (half it for now)
            for (int i = 0; i < MassPoints.Length; i++)
            {
                MassPoints[i].Mass /= 2;
            }
            // add a special destruction circle cloud that will follow you
            if (!DamageCloudTailNodes.Any())
            {
                var dctNode = new DamageCloudTailNode(0, CCPoint.Zero);
                dctNode.AutoAddClouds = false;
                DamageCloudTailNodes.Add(dctNode);
            }
            var destructionCircleCloud = new CircleCloud(PositionWorldspace, 0, CCColor4B.White, true, (ContentSize.Width + ContentSize.Height) * GetTotalScale() + 100f, 5f);

            destructionCircleCloud.FollowTarget = this;
            DamageCloudTailNodes.First().AddCloud(destructionCircleCloud);
            // also kill all parts that are mounted to you
            foreach (var part in MountedParts)
            {
                part.Die(false);
            }
            if (callPartsChanged)
            {
                Aircraft.PartsChanged(deathPossible: true);
            }
        }