コード例 #1
0
    /// <summary>
    /// Call this when the attacker is taken out of the game by something that the defenders aren't rewarded for (e.g., the end of a wave).
    /// </summary>
    public virtual void BeRemovedFromBoard()
    {
        Services.Board.TakeThingFromSpace(XPos, ZPos);
        EjectAttackerTask throwTask = new EjectAttackerTask(GetComponent <Rigidbody>());

        throwTask.Then(new DestroyAttackerTask(gameObject));
        Services.Tasks.AddTask(throwTask);
    }
コード例 #2
0
    /// <summary>
    /// Take a marker off the board. This uses tasks written for attackers; they work fine for this purpose.
    /// </summary>
    /// <param name="marker">Marker.</param>
    private void RemoveMarker(GameObject marker)
    {
        marker.tag = REMOVED_TAG;
        EjectAttackerTask ejectTask = new EjectAttackerTask(marker.GetComponent <Rigidbody>());

        ejectTask.Then(new DestroyAttackerTask(marker));
        Services.Tasks.AddTask(ejectTask);
    }
コード例 #3
0
    /// <summary>
    /// Call this when this attacker is defeated by a defender.
    /// </summary>
    public virtual void BeReducedToZero()
    {
        Services.Attackers.EliminateAttacker(this);
        Services.Board.TakeThingFromSpace(XPos, ZPos);
        UnregisterForEvents();

        AttackerFallTask  fallTask  = new AttackerFallTask(GetComponent <Rigidbody>());
        EjectAttackerTask throwTask = new EjectAttackerTask(GetComponent <Rigidbody>());

        fallTask.Then(throwTask);
        throwTask.Then(new DestroyAttackerTask(gameObject));
        Services.Tasks.AddTask(fallTask);
    }