示例#1
0
    //restores if deactivated
    public void Activate()
    {
        if (_ship == null)
        {
            Log(_ship.ToString());

            Log(modName + " can not activate. No owner found.");
            return;
        }

        if (!_ship.isNeutralized())
        {
            if (status == moduleStatus.offline)
            {
            }
            Log(modName + " has restored power");

            if (status == moduleStatus.waiting)
            {
                Log(modName + " now online");
            }

            status     = moduleStatus.online;
            HP         = maxHP;
            ShowDamage = false;
        }
        else
        {
            status     = moduleStatus.offline;
            HP         = 0;
            ShowDamage = false;
        }
    }
示例#2
0
    private void OnValidate()
    {
        //check if there is more than one ship module on the same gameobject

        if (GetComponents <ShipModule>().Length > 1)
        {
            status = moduleStatus.error;
            Log("ERROR: Multiple modules on same gameobject");
            gameObject.SetActive(false);
        }
    }
示例#3
0
 public void Deactivate()
 {
     HP = 0;
     if (status == moduleStatus.damaged || status == moduleStatus.online)
     {
         status = moduleStatus.offline;
         Log(modName + " has been disabled.");
         ShowDamage = true;
     }
     if (status == moduleStatus.error)
     {
         gameObject.SetActive(false);
         //just kill this if it's in error;
     }
 }