Esempio n. 1
0
    public void MoveTile(GameObject tileGameObject, Vector2 direction)
    {
        Layer tileLayer = FindTileLayer(tileGameObject);

        if (tileLayer != null)
        {
            if (tileLayer.MoveTile(tileGameObject, direction))
            {
                RockBehavior rockBehavior = tileGameObject.GetComponent <RockBehavior>();

                if (rockBehavior != null)
                {
                    rockBehavior.PlayMoveSound();
                }
            }
        }
        UpdateFountain();
    }
    /// <summary>
    /// Rocks the flurr.
    /// every 20 sec, the unit will auto-cast a flurry of small rocks in an 30 degrees arc movement to cover the enemy
    /// area from top to bottom. The small rocks do very little damage (0.5%) per hit, and there 20-40 rocks thrown
    /// on each cast. If one of rocks hits the lone scout, it does enough damage to kill it.
    /// </summary>
    void rockFlurrShooting()
    {
        float radius = 5;

        float      x = -Mathf.Sin(startAngle) * radius + gameObject.transform.position.x;
        float      y = 0f;
        float      z = Mathf.Abs(Mathf.Cos(startAngle) * radius) + gameObject.transform.position.z;
        Vector3    shootingPosition = new Vector3(x, y, z);
        Quaternion rotation         = new Quaternion(gameObject.transform.rotation.x,
                                                     gameObject.transform.rotation.y,
                                                     gameObject.transform.rotation.z, 1);
        RockBehavior mov = projectile.GetComponent <RockBehavior>();

        mov.direction = new Vector3(x - gameObject.transform.position.x, 0f, z - gameObject.transform.position.z);
        //projectile.RotateAround(gameObject.transform.position,new Vector3(0,0,1),startAngle);
        mov.gameObject.tag = this.gameObject.tag;
        Instantiate(projectile, shootingPosition, rotation);
        if (topToBottom)
        {
            if (startAngle < 180)
            {
                startAngle += 1;
            }
            else
            {
                topToBottom = false;
            }
        }
        else if (startAngle > 0)
        {
            startAngle -= 1;
        }
        else
        {
            topToBottom = true;
        }
    }
Esempio n. 3
0
 public CaughtRockState(RockBehavior rb) : base(rb)
 {
     joint = rb.GetComponent <TargetJoint2D>();
 }
Esempio n. 4
0
 public DefaultRockState(RockBehavior rb) : base(rb)
 {
 }
Esempio n. 5
0
 public SunkRockState(RockBehavior rb) : base(rb)
 {
 }
Esempio n. 6
0
 public SinkingRockState(RockBehavior rb, SeaBehavior sb) : base(rb)
 {
     seaBehavior = sb;
 }