Exemplo n.º 1
0
    static void SetDestructionValues(Transform t)
    {
        Destruction destruction = t.gameObject.GetComponent <Destruction> ();

        destruction.startBroken        = false;
        destruction.explodeOnCollision = true;
    }
Exemplo n.º 2
0
    void RaycastPlayer()
    {
        Vector3 forward = transform.TransformDirection(Vector3.forward) * RayDistance;

        Debug.DrawRay(transform.position, forward, Color.green);

        if (Physics.Raycast(transform.position, (forward), out hit))
        {
            theDistance = hit.distance;
            //print(theDistance + " " + hit.collider.gameObject.name);



            //เปลียนหน้าดิน
            if (hit.collider.tag.Equals("Wood"))
            {
                TargetHit   target     = hit.transform.GetComponent <TargetHit>();
                Destruction swapTarget = hit.transform.GetComponent <Destruction>();
                if (swapTarget != null)
                {
                    swapTarget.SwapObject();
                    target.TakeDamage(damage);
                }
                //Instantiate(destroyedVersion, transform.position, transform.rotation);
            }
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            Ray        r = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(r, out hit, maxRayCastDist, destructionMask))
            {
                rayStarts.Add(gameObject.transform.position);
                rayEnds.Add(hit.point);

                Destruction destruction = hit.collider.gameObject.GetComponent <Destruction>();
                if (destruction == null)
                {
                    Debug.LogWarning("Camera ray hit game object that doesn't have destruction component");
                }
                else
                {
                    destruction.ReceiveDamage(hit);
                }
            }
        }

        int rayCount = rayStarts.Count;

        for (int i = 0; i < rayCount; ++i)
        {
            Debug.DrawLine(rayStarts[i], rayEnds[i], Color.cyan);
        }
    }
Exemplo n.º 4
0
    private IEnumerator CreateExplosions(Vector3 direction)
    {
        for (int i = 1; i < 3; i++)
        {                   //The 3 here dictates how far the raycasts will check, in this case 3 tiles far
            RaycastHit hit; //Holds all information about what the raycast hits



            Physics.Raycast(transform.position + new Vector3(0, .5f, 0), direction, out hit, i, levelMask);   //Raycast in the specified direction at i distance, because of the layer mask it'll only hit blocks, not players or bombs

            if (!hit.collider)
            { // Free space, make a new explosion
                Instantiate(explosionPrefab, transform.position + (i * direction), explosionPrefab.transform.rotation);
                Collider[] coll = Physics.OverlapSphere(transform.position, 0.6f);

                foreach (Collider nearbyObject in coll)
                {
                    //Debug.Log("Boom");
                    Destruction dest = nearbyObject.GetComponent <Destruction>();
                    if (dest != null)
                    {
                        dest.DestructionBomb();
                    }
                }
            }
            else
            { //Hit a block, stop spawning in this direction
                break;
            }

            yield return(new WaitForSeconds(.05f)); //Wait 50 milliseconds before checking the next location
        }
    }
Exemplo n.º 5
0
 public void TickClasses()
 {
     Character.Position = MovementController.ActualPosition(Character);
     Checkers?.Tick();
     Attack?.Tick();
     Damage?.Tick();
     Heal?.Tick();
     Destruction?.Tick();
     Effects?.Tick();
 }
Exemplo n.º 6
0
    void Awake()
    {
        spawnTimer   = 3f;
        destroyTimer = 2f;
        canExplode   = true;
        destruction  = GameObject.FindObjectOfType(typeof(Destruction)) as Destruction;



        //Destroy (gameObject, 3f);
    }
Exemplo n.º 7
0
 public LineParticle(Color color, GraphicsDevice graphicsDevice, Vector position, Vector velocity, Destruction destruction)
     : base(graphicsDevice, position, velocity, destruction)
 {
     this.Color = color;
     this.line = new BasicEffect(graphicsDevice);
     this.line.VertexColorEnabled = true;
     this.line.Projection = Matrix.CreateOrthographicOffCenter
         (0, graphicsDevice.Viewport.Width,     // left, right
          graphicsDevice.Viewport.Height, 0,    // bottom, top
          0, 1);
 }
Exemplo n.º 8
0
        public void Deactivate()
        {
            Exit();
            Destruction.Remove();

            var ownerSession = World.StorageManager.GetGameSession(Pet.GetOwner().Id);

            if (ownerSession != null)
            {
                //TODO: Fix
                //Packet.Builder.PetDeactivationCommand(ownerSession, Pet);
            }
        }
Exemplo n.º 9
0
        public AbstractCharacterController(Character character)
        {
            Character = character;

            Checkers    = new Checkers(this);
            Attack      = new Attack(this);
            Damage      = new Damage(this);
            Heal        = new Heal(this);
            Destruction = new Destruction(this);
            Effects     = new Effects(this);

            StopController = false;
        }
Exemplo n.º 10
0
 /// <summary>
 /// This method used for add destruction object. -An
 /// </summary>
 /// <param name="destruction"></param>
 /// <returns></returns>
 public Destruction AddDestruction(Destruction destruction)
 {
     try
     {
         _iDestructionContext.Add(destruction);
         _iDestructionContext.SaveChanges();
         return(destruction);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemplo n.º 11
0
        public void Destroy()
        {
            Exit();
            Destruction.Remove();

            var ownerSession = World.StorageManager.GetGameSession(Pet.GetOwner().Id);

            if (ownerSession != null)
            {
                //TODO: Fix
                //Packet.Builder.PetIsDestroyedCommand(ownerSession);
                //Packet.Builder.PetUIRepairButtonCommand(ownerSession, true, 0);
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// This method used for update destruction return primary key. -An
 /// </summary>
 /// <param name="destruction"></param>
 /// <returns></returns>
 public int UpdateDestruction(Destruction destruction)
 {
     try
     {
         destruction.ModifiedDateTime = DateTime.UtcNow;
         _iDestructionContext.Update(destruction);
         _iDestructionContext.SaveChanges();
         return(destruction.Id);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemplo n.º 13
0
    void OnTriggerEnter(Collider collision)
    {
        new WaitForSeconds(0.1f);
        if (collision.tag == "Enemy")
        {
            EnemyLife life = collision.GetComponent <EnemyLife>();
            life.recibirDaño(daño);
            Destroy(this.gameObject);
        }

        if (collision.tag == "Breakable")
        {
            Destruction destr = collision.GetComponent <Destruction>();
            destr.Destruir();
            Destroy(this.gameObject);
        }
    }
Exemplo n.º 14
0
        public void Repair()
        {
            var price = 15 * Pet.Level.Id;

            Destruction.RevivePet();
            var ownerSession = Pet.GetOwner().GetGameSession();

            if (ownerSession.Player.Information.Premium.Active)
            {
                Packet.Builder.LegacyModule(ownerSession, $"0|A|STD|Repaired P.E.T, repair costs covered by Premium");
            }
            else
            {
                ownerSession.Player.Information.Uridium.Remove(price);
                Packet.Builder.LegacyModule(ownerSession, $"0|A|STD|Repaired P.E.T, -{price} U.");
            }
            Packet.Builder.PetInitializationCommand(ownerSession, Pet);
        }
Exemplo n.º 15
0
 public void Crash(Character character, int damage = 0)
 {
     PathFollower.Initiate(character, true);
     Task.Delay(3000).ContinueWith((t) =>
     {
         if (!Active || StopController)
         {
             return;
         }
         if (damage > 0)
         {
             Damage.Area(damage, Damage.Types.KAMIKAZE, 500);
         }
         Destruction.Kill();
         Exit();
         OnPetDestruction();
     });
 }
        public static void Generate(WeakAura wa)
        {
            var destruction = new Destruction();

            var builder = new SpecBuilder(ClassSpec.Destruction);

            builder.AddOverflow(
                destruction.GrimoireSacrifice.Buff(), // T6
                destruction.FelDomination.Buff(),
                destruction.CreateSoulwell,
                destruction.Soulstone,
                destruction.RitualOfDoom
                ).AddRightBar(
                // destruction.Deathbolt,
                destruction.DarkPact.Buff(),       // T3
                destruction.MortalCoil.DeBuff(),   // T5
                destruction.HowlOfTerror.DeBuff(), // T5
                destruction.Shadowfury.DeBuff()
                ).AddCoreRotation(
                destruction.Immolate.DoT(),
                destruction.Conflagrate.Buff(),
                destruction.Shadowburn.Buff()
                // destruction.Corruption.DoT(),
                ).AddCoreCooldowns(
                destruction.SummonInfernal.Buff(),
                destruction.Havoc.Buff(),
                destruction.Cataclysm.Buff(),    // T4
                destruction.ChannelDemonfire,    // T7
                destruction.DarkSoulInstability, // T7
                destruction.SoulFire             // T1
                ).AddBottomBar(
                destruction.BurningRush.Buff(),  // T3
                destruction.DemonicCircleTeleport,
                destruction.CommandDemon
                ).AddTopBar(
                destruction.Eradication.Passive().Buff(),    // T1
                destruction.Backdraft.Passive().Buff(),
                destruction.ReverseEntropy.Passive().Buff(), // T2
                destruction.RainOfFire.Passive().DeBuff(),
                destruction.UnendingBreath.Passive().Buff()
                ).AddAlerts(
                destruction.EyeOfKilrogg.Passive().Buff()
                ).Build(wa);
        }
Exemplo n.º 17
0
    void OnTriggerEnter(Collider collision)
    {
        if (ataque)
        {
            if (collision.tag == "Enemy")
            {
                EnemyLife life = collision.GetComponent <EnemyLife>();
                life.recibirDaño(100);
                ataque = false;
            }

            if (collision.tag == "Breakable")
            {
                Destruction destr = collision.GetComponent <Destruction>();
                destr.Destruir();
                ataque = false;
            }
        }
    }
Exemplo n.º 18
0
 public LineParticle(Pen pen, Vector position, Vector velocity, Destruction destruction)
     : base(position, velocity, destruction)
 {
     this.Pen = pen;
 }