コード例 #1
0
ファイル: Soul.cs プロジェクト: GiulianoDecesares/SoulRepair
    public void Broke()
    {
        // This check sucks
        if (this.behavior is HealthySoulBehavior || this.behavior == null)
        {
            this.behavior = new BrokenSoulBehavior(this);
            this.behavior.Initialize();

            this.UpdateEvents();

            this.IsBroken = true;

            // Notify manager
            this.manager.OnSoulBroke();
        }
    }
コード例 #2
0
ファイル: Soul.cs プロジェクト: GiulianoDecesares/SoulRepair
    public void Repair()
    {
        // This check sucks even more
        if (this.behavior == null)
        {
            this.behavior = new HealthySoulBehavior(this);
            this.behavior.Initialize();

            this.UpdateEvents();

            this.IsBroken = false;
        }
        else if (this.behavior is BrokenSoulBehavior)
        {
            Destroy(this.gameObject);

            // Notify manager
            this.manager.OnSoulRepaired();
        }
    }