Exemple #1
0
        void doAction(TriggerAction action, Collider other)
        {
            GameObject go;

            if (action.animator != null && action.state != "")
            {
                action.animator.Play(action.state);
            }
            if (action.prefabName != "")
            {
                action.prefab     = GameObject.Find(action.prefabName);
                action.prefabName = "";
            }
            if (action.prefab)
            {
                switch (action.preafabAction)
                {
                case PreafabAction.Deactivate:
                    action.prefab.SetActive(false);
                    break;

                case PreafabAction.Activate:
                    action.prefab.SetActive(true);
                    break;

/*TODO:
 *                      case PreafabAction.Spawn:
 *                              go=Spawner.Spawn (action.prefab, transform.position, Quaternion.identity);
 *                              go.SetActive(true);
 *                              if (destroyDelay>0) GameObject.Destroy(go,destroyDelay);
 *                              break;
 *                      case PreafabAction.SpawnDown:
 *                              go=Spawner.SpawnDown (action.prefab,gameObject, 100.0);
 *                              go.SetActive(true);
 *                              if (destroyDelay>0) GameObject.Destroy(go,destroyDelay);
 *                              break;
 */
                case PreafabAction.DiePlaceEnter:
                    DiePlaceEnter(other.gameObject);
                    break;

                case PreafabAction.DiePlaceLive:
                    DiePlaceLive(other.gameObject);
                    break;
                }
            }
            if (action.damageUse)
            {
                ApplayDamage(other.gameObject, action);
            }
        }
Exemple #2
0
        void ApplayDamage(GameObject target, TriggerAction action)
        {
/*todo:
 *      Health targetHealth ;
 *      if (damageRadius>0){
 *                      Collider[] hitsDem   = Physics.OverlapSphere (transform.position, damageRadius, action.layers.value);
 *                      foreach (Collider c  in hitsDem) {
 *                              targetHealth  = c.GetComponent.<Health> ();
 *                              if (targetHealth) {
 *                                      targetHealth.OnDamageForce (damageAmount, -transform.forward, damageForce);
 *                              }
 *                      }
 *      }else{
 *              targetHealth = target.GetComponent.<Health> ();
 *              if (targetHealth) {
 *                              // Apply damage
 *                              targetHealth.OnDamageForce (damageAmount, -transform.forward, damageForce);
 *              }
 *      }
 */
        }