示例#1
0
 public static void InvokeOnKilled(LifeControl life)
 {
     if (OnKilled != null)
     {
         OnKilled(life);
     }
 }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     fruitRb     = GetComponent <Rigidbody2D>();
     scoreText   = GameObject.FindGameObjectWithTag("Score").GetComponent <Text>();
     lifeControl = GameObject.FindGameObjectWithTag("Life").GetComponent <LifeControl>();
     fruitRb.AddForce(transform.up * force, ForceMode2D.Impulse);
 }
示例#3
0
    void UpdatePlayerOneUnitText()
    {
        if (UC.ListOneCount() == 0)
        {
            return;
        }

        List <GameObject> mUnitList = UC.GetPlayerOneUnits();

        if (mUnitList == null)
        {
            return;
        }
        int unitcount = 0;

        mPlayerOneUnitsText = "Player One's Units \n";
        foreach (var obj in mUnitList)
        {
            BasicUnitScript BS = obj.GetComponent <BasicUnitScript>();
            LifeControl     LC = obj.GetComponent <LifeControl>();
            BlobProperties  BP = obj.GetComponent <BlobProperties>();

            unitcount++;
            mPlayerOneUnitsText = mPlayerOneUnitsText +
                                  "Unit " + unitcount + ": " + BS.GetUnitName() +
                                  ". OwnerID: " + BS.GetOwnerID() + ". UnitID: " + BS.GetUnitID() + "\n"
                                  + " HP: " + LC.GetHP() + " Enemeies in Range: " + BP.enemiesInRange.Count + " Enemies in Sight: " + BP.enemiesInSight.Count + " \n";
        }
        mPlayerOneUnits.text = mPlayerOneUnitsText;
    }
示例#4
0
 void Start()
 {
     col  = GetComponent <BoxCollider2D>();
     lc   = GetComponent <LifeControl>();
     bite = GetComponent <Bite>();
     jumpAnim.frameTime = float.PositiveInfinity;
     timeStart          = Time.time;
 }
示例#5
0
    void Start()
    {
        lifeControl = GameObject.Find("LifeBase").GetComponent <LifeControl> ();

        GetComponent <MeshRenderer> ().material.color = neutralColor;

        boxCollider = GetComponent <BoxCollider> ();

        CalculateRaySpacing();
    }
示例#6
0
    public Control(int player_id)
    {
        this.setPlayersIds(player_id);
        this.field           = new Field(this);
        this.battleControl   = new BattleControl(this, field);
        this.lifeControl     = new LifeControl(player_id, opponent_id);
        this.mana            = new ManaControl(this);
        this.effects_control = new EffectsControl(this);

        this.hand = GameObject.FindGameObjectWithTag("Hand").GetComponent <Hand>();
    }
示例#7
0
 // Use this for initialization
 void Start()
 {
     life = GameObject.FindGameObjectWithTag("life").GetComponent<LifeControl>();
 }
示例#8
0
 // Use this for initialization
 void Start()
 {
     life       = FindObjectOfType <LifeControl>();
     sound      = PlayerPrefs.GetInt("sound");
     scoreCount = FindObjectOfType <ScoreCounter>();
 }
示例#9
0
    void Awake()
    {
        m_turnControl = new TurnControl ();
        List<int> turns = new List<int>(2);
        turns.Add (TurnControl.TURN_PLAYER);
        turns.Add (TurnControl.TURN_ENEMY_1);
        m_turnControl.initTurns (turns);

        m_playerLifeControl = GameObject.Find ("LifeText").GetComponent<LifeControl>();

        GameObject[] enemyObjs = GameObject.FindGameObjectsWithTag("Enemy");
        enemys = new ArrayList();
        foreach (GameObject t in enemyObjs) {
            enemys.Add(t.GetComponent<EnemyControl>());
        }
        //
        slideControl = gameObject.GetComponent<SlideResultControl>();

        slideControl.slideDelegates += slideTo;

        candys = new Dictionary<int, GameObject> ();

        //create candys
        for (int i = 0; i < mapRow; i++) {
            for(int j = 0 ; j < mapLine ;j++)
            {
                GameObject t = createCandyBy(i,j,randomCandyType());

                candys.Add(i*ROW_SCALE_FOR_KEY + j,t);
            }
        }
    }