Example #1
0
 void Init()
 {
     if (inited)
     {
         return;
     }
     if (myunit == null)
     {
         myunit = this.transform.GetComponentInParent <Unit>();
     }
     myfraction  = myunit.fraction;
     myunitclass = myunit.unitClass;
     inited      = true;
 }
        public GeneralUnit FindGeneral(GlobalDefine.Fraction fraction)
        {
            switch (fraction)
            {
            case GlobalDefine.Fraction.One:
                return(GeneralFraction1);

                break;

            case GlobalDefine.Fraction.Two:
                return(GeneralFraction2);

                break;

            default: return(null);
            }
        }
Example #3
0
 public bool IssueCommand(GlobalDefine.Fraction fraction, int TargetUnitID, Vector2 destinationPosition)
 {
     if (CurrentMessengerNum <= 0)
     {
         return(false);
     }
     else
     {
         Command command = new Command();
         command.m_commandTargetPostion = destinationPosition;
         command.m_fraction             = fraction;
         command.m_TargetUnitID         = TargetUnitID;
         int commandID = CommandManager.instance.GenerateCommand(command);
         SendMessenger(commandID);
         CurrentMessengerNum--;
         pidgeonUI.GetComponent <SpriteRenderer> ().sprite = pidgeonUISprites [CurrentMessengerNum];
         return(true);
     }
 }
Example #4
0
 public virtual void SetFraction(GlobalDefine.Fraction toFraction)
 {
     if (toFraction == GlobalDefine.Fraction.One)
     {
         fraction            = GlobalDefine.Fraction.One;
         oppositeFraction    = GlobalDefine.Fraction.Two;
         this.gameObject.tag = GlobalDefine.ObjectTag.Fraction1Tag;
         //attackRangeCollider.myfraction = GlobalDefine.Fraction.One;
     }
     else if (toFraction == GlobalDefine.Fraction.Two)
     {
         fraction            = GlobalDefine.Fraction.Two;
         oppositeFraction    = GlobalDefine.Fraction.One;
         this.gameObject.tag = GlobalDefine.ObjectTag.Fraction2Tag;
         //attackRangeCollider.myfraction = GlobalDefine.Fraction.Two;
     }
     else
     {
         fraction            = GlobalDefine.Fraction.Netrual;
         oppositeFraction    = GlobalDefine.Fraction.Netrual;
         this.gameObject.tag = GlobalDefine.ObjectTag.Fraction0Tag;
         //attackRangeCollider.myfraction = GlobalDefine.Fraction.Netrual;
     }
 }