public void SetAlignment(mobAffiliation affil = mobAffiliation.NonThreat)
    {
        iff = affil;


        if (iff == mobAffiliation.Ally)
        {
            gameObject.tag = "Ally";
            EngineChange(ScoreKeeper.allyColor);
        }

        if (iff == mobAffiliation.NonThreat)
        {
            gameObject.tag = "NonThreat";
            //  EngineChange(ScoreKeeper.allyColor);
        }

        if (iff == mobAffiliation.Threat)
        {
            gameObject.tag = "NonThreat";
            EngineChange(ScoreKeeper.threatColor);
        }
        //NonThreat = 0, //Harmless: 0s
        //Ally = 10,  //allies 10s
        //Threat = 20,  // threat 20s


        textureChangeOnTag viles = transform.GetComponentInChildren <textureChangeOnTag>();

        if (viles != null)
        {
            viles.TextureChange(gameObject.GetComponent <EnemyShipModular>());
        }
    }
    public bool isFriendly(mobAffiliation requestor = mobAffiliation.Ally)
    {
        if (iff == mobAffiliation.NonThreat)
        {
            return(true);
        }

        //returns true if same broadly the same affiliation

        //neutrals 0-9,
        //allies 10-19
        //enemies 20-30

        bool friendly = ((int)requestor / 10 == (int)iff / 10);

        return(friendly);
    }
Пример #3
0
    public void SetAlignment(mobAffiliation affil = mobAffiliation.NonThreat)
    {
        iff = affil;

        switch (iff)
        {
        case mobAffiliation.Ally:
            gameObject.tag = "Ally";
            ColorChange(ScoreKeeper.allyColor);
            break;

        case mobAffiliation.Threat:
            gameObject.tag = "Threat";
            ColorChange(ScoreKeeper.threatColor);
            break;

        default:
            gameObject.tag = "NonThreat";
            ColorChange(ScoreKeeper.allyColor);
            break;
        }
    }
Пример #4
0
    public bool isHostile(mobAffiliation targetIff = mobAffiliation.Ally)
    {
        //checks if THIS MOB is hostile toward this affiliation, or in general against "good guys"
        int targetCategory = (int)targetIff / 10;

        int shipCategory = (int)iff / 10;

        if (targetCategory == 0)
        {
            return(false);
        }

        if (targetCategory != shipCategory)
        {
            return(true);
        }

        else
        {
            return(false);
        }
    }
Пример #5
0
    public void BulletHit(GameObject shooter, float hitDamage, int iffCode)
    {
        int damage = Mathf.RoundToInt(hitDamage);

        //ignore self-bullets and ignore if dead
        if ((int)condition < 3 || shooter == gameObject)
        {
            return;
        }



        mobAffiliation iff = (mobAffiliation)iffCode;

        //IF ALIVE: take damage
        if ((int)condition > 2)
        {
            modHP(-damage);
        }


        /*  if (shieldsUp)
         * {
         *    if (damage < shieldHP)
         *        shieldHP -= damage;
         *    else if (damage > shieldHP)
         *    {
         *
         *        float shieldhit = damage - shieldHP;
         *        if (shieldHP < 1)
         *            modHP(shieldhit);
         *
         *    }
         * }
         *
         * else if (!shieldsUp)
         *    playerHP -= damage;
         *
         */

        // Wake on all bullets?
        //            if (!active)
        //                Invoke("WarmActive", 1);

        /*
         * if (bullet.shooterIff == null)
         * {
         *  Debug.Log(name + "hit by " + bullet.name + " with no shooter");
         *  return;
         * }*/

        if (!isFriendly(iffCode))
        {
            DialogueBox.tracking = gameObject;
        }

        wasHit = true;  //something ought to clear this flag if it wants to do something



        //ALERT THE CONTROLLER

        /*
         * if (!isFriendly(iffCode))
         * {
         *  // ALERT THE CONTROLLER
         *  //addTarget(shooter, true);
         *  //RedAlert();
         * }
         *
         * if (!tenacious && WeaponsActive())
         * {
         *  if (threats.Length > 0)
         *      navigatingTo = threats[0];
         * }
         */
    }