Esempio n. 1
0
    private void Fire()
    {
        GameObject shot = GameObjectUtil.Instantiate(firePreFabs, transform.position);

        GameObjectUtil.Destroy(shot, timeBeforeDestroyShots);
        switch (direction)
        {
        case Direction.Up:
            shot.GetComponent <FireScript>().Shot(FireScript.Direction.Up);
            break;

        case Direction.Down:
            shot.GetComponent <FireScript>().Shot(FireScript.Direction.Down);
            break;

        case Direction.Right:
            shot.GetComponent <FireScript>().Shot(FireScript.Direction.Right);
            break;

        case Direction.Left:
            shot.GetComponent <FireScript>().Shot(FireScript.Direction.Left);
            break;

        default:

            break;
        }
    }
Esempio n. 2
0
 private void CleanMap()
 {
     for (int i = 0; i < mapHolder.transform.childCount; i++)
     {
         GameObjectUtil.Destroy(mapHolder.transform.GetChild(i).gameObject);
     }
 }
Esempio n. 3
0
 private void CleanMapList()
 {
     for (int i = 0; i < transform.childCount; i++)
     {
         GameObjectUtil.Destroy(transform.GetChild(i).gameObject);
     }
 }
Esempio n. 4
0
 private void cleanObjectChilren(GameObject obj)
 {
     foreach (Transform child in obj.transform)
     {
         GameObjectUtil.Destroy(child.gameObject);
     }
 }
Esempio n. 5
0
 public static void DestroyItems(this IEnumerable <GameObject> list)
 {
     for (int i = list.Count() - 1; i >= 0; --i)
     {
         GameObjectUtil.Destroy(list.ElementAt(i));
     }
 }
Esempio n. 6
0
 // Update is called once per frame
 void Update()
 {
     if (health <= 0)
     {
         health = saveHealth;
         GameObjectUtil.Destroy(this.gameObject);
     }
 }
Esempio n. 7
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.gameObject.tag == "Enemy" || coll.gameObject.tag == "Wall" ||
         coll.gameObject.tag == "Obstacles" || coll.gameObject.tag == "Floor")
     {
         GameObjectUtil.Destroy(this.gameObject);
     }
 }
Esempio n. 8
0
 public void OutofBounds()
 {
     offScreen = false;
     GameObjectUtil.Destroy(gameObject);
     if (DestroyCallback != null)
     {
         DestroyCallback();
     }
 }
 public void OnOutOfBounds()
 {
     offscreen = false;
     GameObjectUtil.Destroy(gameObject);
     if (DestroyCallBack != null)
     {
         DestroyCallBack();
     }
 }
Esempio n. 10
0
        private void Update()
        {
            if (!animation.isPlaying && m_prevIsPlaying)
            {
                GameObjectUtil.Destroy(gameObject);
            }

            m_prevIsPlaying = animation.isPlaying;
        }
Esempio n. 11
0
 private void Start()
 {
     gameManager           = GameObjectUtil.GetSingleton <GameManager>();
     platformDetectionUtil = GameObjectUtil.GetSingleton <PlatformDetectionUtil>();
     // If it's on a console don't show this GameObject
     if (platformDetectionUtil.GetPlatformDefinition().deviceType == DeviceType.Console)
     {
         GameObjectUtil.Destroy(gameObject);
     }
 }
    void OnOutOfBounds()
    {
        offScreen = false;
        GameObjectUtil.Destroy(gameObject);

        if (destroyCallBack != null)
        {
            destroyCallBack();
        }
    }
Esempio n. 13
0
 public void OnOutOfBounds()
 {
     offscreen = false;
     GameObjectUtil.Destroy(gameObject);
     contadorFuera++;
     if (DestroyCallback != null)
     {
         DestroyCallback();
     }
 }
Esempio n. 14
0
    void DestroyObject()
    {
        offscreen = false;
        GameObjectUtil.Destroy(gameObject);

        if (OnDestroyCallback != null)
        {
            OnDestroyCallback();
        }
    }
Esempio n. 15
0
    // Update is called once per frame
    void Update()
    {
        endx = rbody.position.x;
        // endy = rbody.position.y;         - not used JT

        if (Mathf.Abs(endx - startx) > maxDistance) // Changed 30 to maxDistance
        {
            GameObjectUtil.Destroy(this.gameObject);
        }
    }
Esempio n. 16
0
    //"Destroy" the object
    public void OnOutOfBounds()
    {
        //Debug.Log("Out of bounds");
        offscreen = false;
        GameObjectUtil.Destroy(gameObject);

        if (DestroyCallBack != null)
        {
            DestroyCallBack();
        }
    }
    public void OnOutOfBounds()
    {
        offscreen = false;
        GameObjectUtil.Destroy(gameObject);

        // If a method has been connected to the property, call the method
        if (DestroyCallback != null)
        {
            DestroyCallback();
        }
    }
Esempio n. 18
0
    public void OnOutOfBounds()
    {
        offscreen = false;
        // destroys the game object to which this script is attached
        GameObjectUtil.Destroy(gameObject);

        if (DestroyCallback != null)
        {
            DestroyCallback();
        }
    }
Esempio n. 19
0
    void OnCollisionEnter(Collision col)
    {
        ComponentHealth a;

        if (col.gameObject.GetComponent <ComponentHealth>() != null)
        {
            a = col.gameObject.GetComponent <ComponentHealth>();
            a.Damage(m_dmg);
        }
        GameObjectUtil.Destroy(gameObject);
    }
Esempio n. 20
0
    public void OnOutOfBounds()
    {
        offscreen = false;
        GameObjectUtil.Destroy(gameObject);


        //this will be define in the game manager
        if (DestroyCallback != null)
        {
            DestroyCallback();
        }
    }
Esempio n. 21
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.layer == LayerMask.NameToLayer("MovingTiles"))
     {
         other.GetComponent <MoveingBox>().move();
         GameObjectUtil.Destroy(gameObject);
     }
     else if (other.gameObject.layer == LayerMask.NameToLayer("NonMovingTiles"))
     {
         GameObjectUtil.Destroy(gameObject);
     }
 }
Esempio n. 22
0
    /// <summary>
    /// 处理离开游戏可活动区域(屏幕范围)的对象
    /// </summary>
    void OnOutOfBounds()
    {
        // 重置该游戏对象是否离开屏幕范围的标识为 false
        offScreen = false;

        GameObjectUtil.Destroy(gameObject);

        // 调用监听 OnDestroy() 的回调方法
        if (null != DestroyCallback)
        {
            DestroyCallback();
        }
    }
    // Update is called once per frame
    void Update()
    {
        var posX           = transform.position.x;
        var worldUnits     = Screen.width / PixelPerfect.pixelsToUnit;
        var halfWorldUnits = worldUnits / 2;

        if (posX < 0 && (Mathf.Abs(posX) > (halfWorldUnits + padding)))
        {
            print("half world units" + halfWorldUnits + "," + (halfWorldUnits + padding) + "," + posX);
            //DestroyObject(gameObject);
            GameObjectUtil.Destroy(gameObject);
        }
    }
    void OutOfBounds()
    {
        offscreen = false;

        GlobalSettings.Instance.ActiveObjects.Remove(gameObject.name);

        GameObjectUtil.Destroy(gameObject);

        if (DestroyCallback != null)
        {
            DestroyCallback();
        }
    }
Esempio n. 25
0
 static int Destroy(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject <UnityEngine.Object>(L, 1);
         GameObjectUtil.Destroy(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 26
0
    public void OnOutOfBounds()
    {
        // handles object going offscreen

        // Current offScreen = false line is future-proofing for when we reuse this object later
        offScreen = false;

        GameObjectUtil.Destroy(gameObject);

        if (DestroyCallback != null)
        {
            DestroyCallback();             // call this as if it were a method
        }
    }
 private void Update()
 {
     if (particleSystem.isPlaying)
     {
         m_hasPlayed = true;
     }
     else if (m_hasPlayed)
     {
         if (childParticleSystems.All(x => x.isStopped))
         {
             GameObjectUtil.Destroy(gameObject);
         }
     }
 }
Esempio n. 28
0
    // Update is called once per frame
    private void Update()
    {
        if (readyToDissapear)
        {
            t += Time.deltaTime;
            spriteRenderer.material.color = Color.Lerp(start, end, t / 2);

            GetComponent <Rigidbody2D>().velocity = new Vector2(-95, GetComponent <Rigidbody2D>().velocity.y);

            if (spriteRenderer.material.color.a <= 0.0)
            {
                GameObjectUtil.Destroy(gameObject);
            }
        }
    }
Esempio n. 29
0
    private void Start()
    {
        //soundManager = GameObjectUtil.GetSingleton<SoundManager>();
        platformDetectionUtil = GameObjectUtil.GetSingleton <PlatformDetectionUtil>();

        //TODO need to add in way to save mute

        // If it's on a console don't show this GameObject
        if (platformDetectionUtil.GetPlatformDefinition().deviceType == DeviceType.Console)
        {
            GameObjectUtil.Destroy(gameObject);
        }

        UpdateLabel();
    }
Esempio n. 30
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         GameObjectUtil.Destroy(player);
         if (DestroyCallback != null)
         {
             DestroyCallback();
         }
     }
     if (!gameStarted && Time.timeScale == 0)
     {
         if (Input.GetKeyDown(KeyCode.Z))
         {
             timeManager.ManipulateTime(1, 1.0f);
             ResetGame();
         }
     }
 }