private void OnExplode(float timeMS, ExploderObject.ExplosionState state)
        {
            if (state == ExploderObject.ExplosionState.ExplosionStarted)
            {
                // deactivate the grenade game object
                ExploderUtils.SetVisible(gameObject, false);

                // play explosion sound
                SourceExplosion.PlayOneShot(ExplosionSound);

                Flash.gameObject.transform.position = gameObject.transform.position;
                Flash.gameObject.transform.position += Vector3.up;

                // turn on flash light for 5 frames
                flashing = 10;

                ExplosionEffect.gameObject.transform.position = gameObject.transform.position;
                ExplosionEffect.Emit(1);

                ExploderUtils.Log("OnExplode started");
            }

            if (state == ExploderObject.ExplosionState.ExplosionFinished)
            {
                ExplodeFinished = true;
                explosionInProgress = false;

                ExploderUtils.Log("OnExplode finished");
            }
        }
예제 #2
0
 private void OnExplosion(float time, ExploderObject.ExplosionState state)
 {
     if (state == ExploderObject.ExplosionState.ExplosionFinished)
     {
         //Utils.Log("Exploded");
     }
 }
 private void OnExplosion(float time, ExploderObject.ExplosionState state)
 {
     if (state == ExploderObject.ExplosionState.ExplosionFinished)
     {
         //UnityEngine.Debug.Log("Exploded");
     }
 }
예제 #4
0
 void OnExplosion(float timeMS, ExploderObject.ExplosionState state)
 {
     if (state == ExploderObject.ExplosionState.ExplosionFinished)
     {
         Finish();
     }
 }
예제 #5
0
        void Awake()
        {
            Instance = gameObject.GetComponent <ExploderObject>();

#pragma warning disable 618
            ExploderInstance = Instance;
#pragma warning restore 618
        }
 private void Start()
 {
     Application.set_targetFrameRate(60);
     this.exploder = ExploderSingleton.Instance;
     foreach (GameObject gameObject in this.toCrack)
     {
         this.exploder.CrackObject(gameObject);
     }
 }
예제 #7
0
        private void Start()
        {
            Application.targetFrameRate = 60;

            //
            // access exploder from singleton
            //
            Exploder = Utils.ExploderSingleton.ExploderInstance;
        }
예제 #8
0
        private void ExplodeObject(GameObject obj)
        {
            ExploderObject component = (ExploderObject)obj.GetComponent <ExploderObject>();

            if (!Object.op_Implicit((Object)component))
            {
                return;
            }
            component.ExplodeObject(((Component)this).get_gameObject(), new ExploderObject.OnExplosion(this.OnExplosion));
        }
예제 #9
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         ExploderObject exploder = GameObject.Find("exploder").GetComponent <ExploderObject>();
         exploder.gameObject.SetActive(true);
         exploder.transform.position = transform.position;
         exploder.Explode();
     }
 }
예제 #10
0
 void CreateBlock()
 {
     blockCube = Instantiate(blockCube) as GameObject;
     blockCube.name = "Block";
     exploder = blockCube.GetComponent<ExploderObject>();
     blockCube.SetActive(true);
     blockCube.transform.position = new Vector3(0,4,-distance);
     blockCube.transform.parent = transform;
     blockCube.transform.DOLocalRotate (new Vector3 (0, 360, 0), 3).SetRelative ().SetLoops (-1, LoopType.Yoyo);
     currentGesture = Random.Range (0, gestureTextures.Length);
     blockCube.GetComponent<MeshRenderer> ().material.mainTexture = gestureTextures [currentGesture];
 }
예제 #11
0
    private void Start()
    {
        _animator  = GetComponent <Animator>();
        _rigidbody = rigidbody;
        _rotation  = transform.rotation;
        _exploder  = GetComponent <ExploderObject>();

        Invoke("Phase1", 0f);
        Invoke("Phase2", 2.4f);
        Invoke("Phase3", 3.3f);
        Invoke("Phase4", 4.2f);
        Invoke("Phase5", 5f);
    }
예제 #12
0
    private void OnEnable()
    {
        fragment = this.target as Fragment;

        if (fragment)
        {
            exploder = GameObject.FindObjectOfType <ExploderObject>();

            if (exploder)
            {
                exploderSerObject = new SerializedObject(exploder);
            }
        }
    }
예제 #13
0
        private void OnExplode(float timeMS, ExploderObject.ExplosionState state)
        {
            if (state == ExploderObject.ExplosionState.ExplosionStarted)
            {
                // play explosion sound
                SourceExplosion.PlayOneShot(ExplosionSound);

                Flash.gameObject.transform.position = ChairBomb.transform.position;
                Flash.gameObject.transform.position += Vector3.up;

                // turn on flash light for 10 frames
                flashing = 10;
            }
        }
예제 #14
0
 private void Start()
 {
     this.Exploder = ExploderSingleton.Instance;
     if (this.Exploder.DontUseTag)
     {
         Object[]          objectsOfType  = Object.FindObjectsOfType(typeof(Explodable));
         List <GameObject> gameObjectList = new List <GameObject>(objectsOfType.Length);
         gameObjectList.AddRange(((IEnumerable)objectsOfType).Cast <Explodable>().Where <Explodable>((Func <Explodable, bool>)(ex => Object.op_Implicit((Object)ex))).Select <Explodable, GameObject>((Func <Explodable, GameObject>)(ex => ((Component)ex).get_gameObject())));
         this.DestroyableObjects = gameObjectList.ToArray();
     }
     else
     {
         this.DestroyableObjects = GameObject.FindGameObjectsWithTag("Exploder");
     }
 }
예제 #15
0
        private void Start()
        {
            Exploder = Utils.ExploderSingleton.ExploderInstance;

            if (Exploder.DontUseTag)
            {
                var objs    = FindObjectsOfType(typeof(Explodable));
                var objList = new List <GameObject>(objs.Length);
                objList.AddRange(from Explodable ex in objs where ex select ex.gameObject);
                DestroyableObjects = objList.ToArray();
            }
            else
            {
                // find all objects in the scene with tag "Exploder"
                DestroyableObjects = GameObject.FindGameObjectsWithTag("Exploder");
            }
        }
    /// <summary>
    /// exploder callback
    /// </summary>
    void OnExplosion(float time, ExploderObject.ExplosionState state)
    {
        // explosion is finished
        if (state == ExploderObject.ExplosionState.ExplosionFinished)
        {
            //!
            //! HERE IS THE LIST OF ACTIVE FRAGMENTS
            //!

        //            var list = FragmentPool.Instance.GetActiveFragments();

            // NOTE:
            // if you run another explosion afterwards and you dont clear or deactivate fragmets in fragment pool
            // you might get some of the fragments from old explosion as well
            // to deactivate fragments you can call FragmentPool.Instance.DeactivateFragments()
        }
    }
예제 #17
0
    protected override void Start()
    {
        base.Start();

        _exploder = this.GetComponentInChildren <ExploderObject>();

        _audioPlayer = this.GetComponent <AudioSource>();
        if (_audioPlayer == null)
        {
            Debug.LogError(this.gameObject.name + " could not find its audio player");
        }

        if (eggLeftoversGO == null)
        {
            Debug.LogWarning(this.gameObject.name + " is missing a eggLeftoversPrefab reference");
        }
    }
예제 #18
0
        private void Start()
        {
            Exploder = Utils.ExploderSingleton.ExploderInstance;

            if (Exploder.DontUseTag)
            {
                var objs = FindObjectsOfType(typeof (Explodable));
                var objList = new List<GameObject>(objs.Length);
                objList.AddRange(from Explodable ex in objs where ex select ex.gameObject);
                DestroyableObjects = objList.ToArray();
            }
            else
            {
                // find all objects in the scene with tag "Exploder"
                DestroyableObjects = GameObject.FindGameObjectsWithTag("Exploder");
            }
        }
 private void Start()
 {
     this.DestroyableObjects = GameObject.FindGameObjectsWithTag("Exploder");
     this.Exploder           = ExploderSingleton.Instance;
 }
예제 #20
0
 void Start()
 {
     ExploderInstance = gameObject.GetComponent <ExploderObject>();
 }
예제 #21
0
 void Awake()
 {
     ExploderInstance = gameObject.GetComponent <ExploderObject>();
 }
예제 #22
0
 void Start()
 {
     exploder = GameObject.Find("Exploder").GetComponent <ExploderObject>();
 }
예제 #23
0
 void Start()
 {
     root = GetRoot();
     exploder = root.GetComponent<ExploderObject>();
 }
	void Awake(){
		sInstance = this;
		m_Exploder = GetComponent<ExploderObject>();
		mTouch_Start = new Vector2[10];
		mTouch_End = new Vector2[10];
		TouchDetectRange = new Vector2 (50f,50f);
       
	}
예제 #25
0
 void Start()
 {
     ExploderInstance = gameObject.GetComponent<ExploderObject>();
 }
예제 #26
0
        private void Update()
        {
            GameObject gameObject = (GameObject)null;
            TargetType targetType = TargetManager.Instance.TargetType;

            if (targetType == TargetType.UseObject)
            {
                if (this.lastTarget == TargetType.UseObject)
                {
                    ;
                }
                this.lastTarget = TargetType.UseObject;
            }
            if (this.lastTarget != TargetType.UseObject)
            {
                ;
            }
            this.lastTarget = targetType;
            Ray ray = this.MouseLookCamera.mainCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f));

            Debug.DrawRay(((Ray) ref ray).get_origin(), Vector3.op_Multiply(((Ray) ref ray).get_direction(), 10f), Color.get_red(), 0.0f);
            if (targetType == TargetType.DestroyableObject)
            {
                gameObject = TargetManager.Instance.TargetObject;
            }
            if (Input.GetMouseButtonDown(0) && (double)this.nextShotTimeout < 0.0 && CursorLocking.IsLocked)
            {
                if (targetType != TargetType.UseObject)
                {
                    this.Source.PlayOneShot(this.GunShot);
                    this.MouseLookCamera.Kick();
                    this.reloadTimeout = 0.3f;
                    this.flashing      = 5;
                }
                if (Object.op_Implicit((Object)gameObject))
                {
                    ((Component)this.exploder).get_transform().set_position(ExploderUtils.GetCentroid(gameObject));
                    this.exploder.ExplodeSelf = false;
                    ExploderObject exploder   = this.exploder;
                    Vector3        direction  = ((Ray) ref ray).get_direction();
                    Vector3        normalized = ((Vector3) ref direction).get_normalized();
                    exploder.ForceVector          = normalized;
                    this.exploder.Force           = 10f;
                    this.exploder.UseForceVector  = true;
                    this.exploder.TargetFragments = 30;
                    this.exploder.Radius          = 1f;
                    this.exploder.ExplodeRadius();
                }
                this.nextShotTimeout = 0.6f;
            }
            this.nextShotTimeout -= Time.get_deltaTime();
            if (this.flashing > 0)
            {
                this.Flash.set_intensity(1f);
                ExploderUtils.SetActive(this.MuzzleFlash, true);
                --this.flashing;
            }
            else
            {
                this.Flash.set_intensity(0.0f);
                ExploderUtils.SetActive(this.MuzzleFlash, false);
            }
            this.reloadTimeout -= Time.get_deltaTime();
            if ((double)this.reloadTimeout >= 0.0)
            {
                return;
            }
            this.reloadTimeout = float.MaxValue;
            this.Source.PlayOneShot(this.Reload);
            this.ReloadAnim.Play();
        }
예제 #27
0
 private void Awake()
 {
     ExploderSingleton.Instance         = (ExploderObject)((Component)this).get_gameObject().GetComponent <ExploderObject>();
     ExploderSingleton.ExploderInstance = ExploderSingleton.Instance;
 }
예제 #28
0
 private void Start()
 {
     DestroyableObjects = GameObject.FindGameObjectsWithTag("Exploder");
     Exploder = Utils.ExploderSingleton.ExploderInstance;
 }
 void Awake()
 {
     ExploderInstance = gameObject.GetComponent<ExploderObject>();
 }
예제 #30
0
 private void Start()
 {
     DestroyableObjects = GameObject.FindGameObjectsWithTag("Exploder");
     Exploder           = Utils.ExploderSingleton.ExploderInstance;
 }