コード例 #1
0
    public Snowball(IEnumerable <Vector2> flightPath)
        : base(SnowballFightGame.SnowballDef, flightPath.First(), SnowballFightGame.SnowballLayer, state: States.Fly)
    {
        FlightPath = flightPath.GetEnumerator();

        if (!FlightPath.MoveNext())
        {
            State = States.Dead;
        }

        DrawOffset = new(-8, -8);
    }
コード例 #2
0
    public override void Update(MooseGame _game, GameTime gameTime)
    {
        if (State == States.Fly)
        {
            Position = FlightPath.Current;
            FlightPath.MoveNext();
            FlightPath.MoveNext();
            FlightPath.MoveNext();
            if (IsBlocked())
            {
                State = States.Hit;
                StateCompleteAction = () => State = States.Dead;
            }
        }

        if (State == States.Dead)
        {
            Remove = true;
        }

        base.Update(_game, gameTime);
    }