Exemple #1
0
    void Awake()
    {
        _Rigidbody   = GetComponent <Rigidbody> ();
        _AudioSource = GetComponent <AudioSource> ();
        _Collider    = GetComponent <CapsuleCollider> ();

        _PikminMask = LayerMask.NameToLayer("Pikmin");

        _CurrentStatSpecifier = PikminStatSpecifier.OnField;
        PikminStatsManager.Add(_Data._Colour, _CurrentMaturity, _CurrentStatSpecifier);
    }
    public void RemoveFrom(PikminStatSpecifier specifier)
    {
        switch (specifier)
        {
        case PikminStatSpecifier.InSquad:
            _InSquad--;
            break;

        case PikminStatSpecifier.OnField:
            _OnField--;
            break;

        case PikminStatSpecifier.InOnion:
            _InOnion--;
            break;

        default:
            break;
        }
    }
    public void AddTo(PikminStatSpecifier specifier)
    {
        switch (specifier)
        {
        case PikminStatSpecifier.InSquad:
            _InSquad++;
            break;

        case PikminStatSpecifier.OnField:
            _OnField++;
            break;

        case PikminStatSpecifier.InOnion:
            _InOnion++;
            break;

        default:
            break;
        }
    }
    // Removes a Pikmin from the stats
    public static void Remove(PikminColour colour, PikminMaturity maturity, PikminStatSpecifier specifier)
    {
        switch (colour)
        {
        case PikminColour.Red:
            _RedStats.RemoveFrom(maturity, specifier);
            break;

        case PikminColour.Yellow:
            _YellowStats.RemoveFrom(maturity, specifier);
            break;

        case PikminColour.Blue:
            _BlueStats.RemoveFrom(maturity, specifier);
            break;

        default:
            break;
        }
    }
    // Removes a Pikmin from their specified maturity level stats
    public void RemoveFrom(PikminMaturity maturity, PikminStatSpecifier specifier)
    {
        switch (maturity)
        {
        case PikminMaturity.Leaf:
            _Leaf.RemoveFrom(specifier);
            break;

        case PikminMaturity.Bud:
            _Bud.RemoveFrom(specifier);
            break;

        case PikminMaturity.Flower:
            _Flower.RemoveFrom(specifier);
            break;

        default:
            break;
        }
    }
    // Adds a Pikmin to their specified matury level stats
    public void AddTo(PikminMaturity maturity, PikminStatSpecifier specifier)
    {
        switch (maturity)
        {
        case PikminMaturity.Leaf:
            _Leaf.AddTo(specifier);
            break;

        case PikminMaturity.Bud:
            _Bud.AddTo(specifier);
            break;

        case PikminMaturity.Flower:
            _Flower.AddTo(specifier);
            break;

        default:
            break;
        }
    }