Inheritance: MonoBehaviour
コード例 #1
0
 public static void RemoveEntity(LOSEntity entity)
 {
     if (Instance != null)
     {
         Instance.Entities.Remove(entity);
     }
 }
コード例 #2
0
 // Allow entities to tell us when theyre added
 public static void AddEntity(LOSEntity entity)
 {
     if (Instance != null && !Instance.Entities.Contains(entity))
     {
         Instance.Entities.Add(entity);
     }
 }
コード例 #3
0
ファイル: healthbar.cs プロジェクト: jgirald/ES2015F
    // Use this for initialization
    void Start()
    {
        if (GetComponent<Identity>().unitType.isBuilding())
        {
            //GetComponent<Health>().setHealth(50);
            //GetComponent<Health>().setMaxHealth(50);
            //GetComponent<Health>().setAuxHealth(50);
            auxMaxHealth = GetComponent<BuildingConstruction>().timer;
            maxHealth = MapValues(auxMaxHealth, 0, auxMaxHealth, GetComponent<Health>().getMaxHealth() / 10, GetComponent<Health>().getMaxHealth());
            curHealth = MapValues(auxMaxHealth - GetComponent<BuildingConstruction>().timer, 0, auxMaxHealth, GetComponent<Health>().getMaxHealth() / 10, GetComponent<Health>().getMaxHealth());
        }
        else
        {
            maxHealth = GetComponent<Health>().getMaxHealth();
            curHealth = GetComponent<Health>().getHealth();
        }

        g = Instantiate(prefab);
        g.transform.SetParent(GameController.Instance.healthBarsParent.transform);

        g.transform.GetChild(0).transform.position = Camera.main.WorldToScreenPoint(GetComponentInChildren<auxHealth>().gameObject.transform.position);
        g1 = g.GetComponentInChildren<auxHealth>().gameObject;

        visualHealth = g.GetComponentInChildren<auxHealth>().i;

        unitLOSEntity = gameObject.GetComponent<LOSEntity>();
    }
コード例 #4
0
ファイル: LOSManager.cs プロジェクト: yakolla/MarineVsAlien
 // Reveal an area
 private void RevealLOS(LOSEntity sight, float los, float fow, float grayscale)
 {
     Rect rect = sight.Bounds;
     RevealLOS(rect, sight.Range, sight.Height + sight.transform.position.y, los, fow, grayscale);
 }
コード例 #5
0
ファイル: LOSManager.cs プロジェクト: yakolla/MarineVsAlien
 public static void RemoveEntity(LOSEntity entity)
 {
     if (Instance != null)
     {
         Instance.Entities.Remove(entity);
         if (Instance.AnimatingEntities.Contains(entity) == true)
             Instance.AnimatingEntities.Remove(entity);
     }
 }
コード例 #6
0
ファイル: LOSManager.cs プロジェクト: yakolla/MarineVsAlien
 // Allow entities to tell us when theyre added
 public static void AddEntity(LOSEntity entity)
 {
     if (Instance != null && !Instance.Entities.Contains(entity)) Instance.Entities.Add(entity);
 }
コード例 #7
0
 public static void RemoveEntity(LOSEntity entity)
 {
     if (Instance != null) Instance.Entities.Remove(entity);
 }
コード例 #8
0
 // Reveal an area
 private void RevealLOS(LOSEntity sight, float los, float fow, float grayscale) {
     Rect rect = sight.Bounds;
     RevealLOS(rect, sight.Range, sight.Height + sight.transform.position.y, los, fow, grayscale);
 }
コード例 #9
0
    // Update is called once per frame
    void Update()
    {
        if (LOSinactive != losMan.revealed)
        {
            LOSinactive = losMan.revealed;
            reveal();
        }

        if (!LOSinactive)
        {
            if (los == null)
            {
                los = GetComponentInParent<LOSEntity>();
                if (los != null)
                {
                    revealState = los.RevealState;
                    newState();
                }
            }
            else
            {
                {
                    if (revealState != los.RevealState)
                    {
                        revealState = los.RevealState;
                        newState();
                    }
                }
            }
        }
    }
コード例 #10
0
ファイル: RTSObject.cs プロジェクト: jgirald/ES2015C
 /*** Metodes per defecte de Unity ***/
 protected virtual void Awake()
 {
     audio = gameObject.AddComponent<AudioSource> ();
     audio.volume = 0.4f;
     rigbody = gameObject.AddComponent<Rigidbody> ();
     rigbody.constraints = RigidbodyConstraints.FreezeAll;
     ent = gameObject.AddComponent<LOSEntity> ();
     objectIconSprite = Resources.Load<Sprite> ("HUD/ObjectIcons/" + GetType ().ToString ());
     objectIconAttack = Resources.Load<Sprite> ("HUD/Unit/AttackStrengthIcon");
     objectIconDefense = Resources.Load<Sprite> ("HUD/Unit/DefenseIcon");
     objectIconAttackRange = Resources.Load<Sprite> ("HUD/Unit/AttackRangeIcon");
     objectIconResource = Resources.Load<Sprite> ("HUD/Unit/Resource");
 }