// public tantrum T;

//Use this for initialization
    void Start()
    {
        if (gameObject.name == "ninja")
        {
            ninjaarm = GameObject.Find("ninja_arm");
        }
        if (gameObject.name == "cowboy")
        {
            throwarm  = GameObject.Find("arm");
            armanim   = throwarm.GetComponent <Animator>();
            cowboyarm = GameObject.Find("cowboyarm");
        }
        anim  = GetComponent <Animator>();
        rb    = gameObject.GetComponentInParent(typeof(Rigidbody2D)) as Rigidbody2D;
        bodyR = gameObject.GetComponentInParent(typeof(Player_movement)) as Player_movement;
        if (bodyR == null)
        {
            Debug.LogError("BodyRotation not found!!");
        }
        if (gameObject.name == "Cowboy")
        {
            throwarm.SetActive(false);
        }
        timer       = Time.time + cannon_cool_down;
        cannon_shot = false;
    }
    //Fire playerShooting;

    // Use this for initialization
    void Start()
    {
        currentHealth  = startHealth;
        playerMovement = GetComponent <Player_movement> ();
        deadText.text  = " ";
        //button.gameObject.SetActive(false);
    }
 // Use this for initialization
 void Start()
 {
     rb            = GetComponent <Rigidbody2D>();
     target        = GameObject.FindObjectOfType <Player_movement>();
     moveDirection = (target.transform.position - transform.position).normalized * moveSpeed;
     rb.velocity   = new Vector2(moveDirection.x, moveDirection.y);
     Destroy(gameObject, 3f);
 }
Beispiel #4
0
 public void SendSouvenir(Player_movement pm)
 {
     Index++;
     if (PorteEnd)
     {
         sr.GetComponent <Animator>().SetTrigger("Door");
     }
     Instantiate(Resources.Load <GameObject>("Particle_souvenir"), spawnSouv.position, Quaternion.identity);
 }
Beispiel #5
0
 private void Awake()
 {
     /*if (Instance != this)
      * {
      *  Destroy(gameObject);
      * }*/
     dz = Dead_zone.Instance;
     pm = Player_movement.Instance;
     cm = CanvasManager.Instance;
 }
Beispiel #6
0
    void Start()
    {
        GetComponent<Rigidbody2D>().velocity = Vector2.down* fallSpeed;
        dataObject = GameObject.Find("VisualizedHealthBar");
        localData = dataObject.GetComponent<HealthBarController>();

		playerObject = GameObject.FindGameObjectWithTag ("Player1").GetComponent<Player_movement> ();

		dataObject = GameObject.FindGameObjectWithTag ("ScoreText");
		score = dataObject.GetComponent<BloodCounter>();
    }
	/*  private and pre-defined */

	// Use this for initialization
	void Start () {
		initY = healthBarTransform.localPosition.y;
		maxX = healthBarTransform.localPosition.x + healthBarTransform.rect.width;
		minX = healthBarTransform.localPosition.x;

		currentHealth = healthSpan;
		bleedingSpeed = defaultBleedingSpeed;
		scoreText = GameObject.FindGameObjectWithTag ("ScoreText").GetComponent<BloodCounter> ();

		playerScript = GameObject.FindGameObjectWithTag ("Player1").GetComponent<Player_movement> ();
	}
Beispiel #8
0
 private void Awake()
 {
     /*if (Instance != this)
      * {
      *  Destroy(gameObject);
      * }*/
     cm      = CanvasManager.Instance;
     pm      = Player_movement.Instance;
     sm      = SpawnManager.Instance;
     posXMax = transform.position.x;
     can     = true;
 }
Beispiel #9
0
 public void animationstart()
 {
     if (!Player_movement.direction())
     {
         transform.Rotate(0, 180, 0);
         didtransform = true;
     }
     else
     {
         transform.Rotate(0, 0, 0);
         didtransform = false;
     }
 }
    // Update is called once per frame
    void Update()
    {
        player_movement_script = player_obj.GetComponent <Player_movement>();

        boost_recharge = player_movement_script.boostBar;    //boostRecharge;
        jump_recharge  = player_movement_script.jumpRecharge;
        blast_recharge = player_movement_script.blastRecharge;

        if (boost_recharge <= 0)
        {
            // Boost ready, set to zero to prevent negative and change color of text
            boost_recharge = 0;
            boost_text     = "<color=#008000>Boost: READY </color>\n";
        }
        else
        {
            // Boost not ready, set color back to red
            boost_text = "<color=#FF3232>Boost: " + boost_recharge.ToString("F2") + "</color>\n";
        }

        if (jump_recharge <= 0)
        {
            // jump ready, set to zero to prevent negative and change color of text
            jump_recharge = 0;
            jump_text     = "<color=#008000>jump: READY </color>\n";
        }
        else
        {
            // jump not ready, set color back to red
            jump_text = "<color=#FF3232>jump: " + jump_recharge.ToString("F2") + "</color>\n";
        }

        if (blast_recharge <= 0)
        {
            // Blast ready, set to zero to prevent negative and change color of text
            blast_recharge = 0;
            blast_text     = "<color=#008000>Blast: READY </color>";
        }
        else
        {
            // Blast not ready, set color back to red
            blast_text = "<color=#FF3232>Blast: " + blast_recharge.ToString("F2") + "</color>";
        }

        recharge_text.text = boost_text + jump_text + blast_text;
    }
    //private bool wantsToBlast = false;

    // Start is called before the first frame update
    void Start()
    {
        player = GameObject.Find("player");

        // turn off mesh renderer to make invisible when not in use
        GetComponent <MeshRenderer>().enabled = false;

        rb.position             = new Vector3(0, -40, -15);
        minScale                = new Vector3(1.5f, 1, 1);
        maxScale                = new Vector3(3, 1, 1);
        rb.transform.localScale = minScale;
        int obstacles = 1 << LayerMask.NameToLayer("obstacles");

        layermask = obstacles;
        maxRange  = 20;

        playerScript = player.GetComponent <Player_movement>();
        playerScript.blastRecharge = 0;
    }
 // Update is called once per frame
 void Update()
 {
     if (Animations.get_cannon_shot())
     {
         anim.SetBool("shot", true);
         tran.localPosition = this.transform.parent.position;
     }
     else
     {
         if (Player_movement.direction())
         {
             rb.velocity = new Vector2(cannon_speed, gameObject.GetComponent <Rigidbody2D>().velocity.y);
         }
         else
         {
             rb.velocity = new Vector2(-cannon_speed, gameObject.GetComponent <Rigidbody2D>().velocity.y);
         }
         anim.SetBool("shot", false);
     }
 }
    // Update is called once per frame
    void Update()
    {
        player_movement_script = player.GetComponent <Player_movement>();

        boost_recharge = player_movement_script.boostBar;
        jump_recharge  = player_movement_script.jumpRecharge;
        blast_recharge = player_movement_script.blastRecharge;

        if (jump_recharge <= 0)
        {
            setReady(jump_meshr);
        }
        else
        {
            setNotReady(jump_meshr);
        }
        if (boost_recharge <= 0)
        {
            setReady(boost_meshr);
        }
        else
        {
            setNotReady(boost_meshr);
        }
        if (blast_recharge <= 0)
        {
            setReady(blast_meshr);
        }
        else
        {
            setNotReady(blast_meshr);
        }

        jump_sphere.transform.position =
            new Vector3(0, 6, player.transform.position.z - 3);
        boost_sphere.transform.position =
            new Vector3(0.5f, 6, player.transform.position.z - 3);
        blast_sphere.transform.position =
            new Vector3(-0.5f, 6, player.transform.position.z - 3);
    }
        public void Setup()
        {
            GameObject bodyGameObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/Body"));

            body = bodyGameObject.GetComponent <Player_movement>();
        }
Beispiel #15
0
 // Start is called before the first frame update
 void Start()
 {
     letsMove     = false;
     playerScript = player.GetComponent <Player_movement>();
 }
Beispiel #16
0
 // Use this for initialization
 void Start()
 {
     the_player      = FindObjectOfType <Player_movement>();
     last_player_pos = the_player.transform.position;
 }
Beispiel #17
0
 // Update is called once per frame
 void Update()
 {
     stamina         = Player_movement.getStamina();
     staminatxt.text = "Stamina: " + Mathf.RoundToInt(stamina);
 }
 void Start()
 {
     player          = FindObjectOfType <Player_movement>();
     enemy           = FindObjectOfType <Enemy_manager>();
     thescoremanager = FindObjectOfType <Score_manager>();
 }
Beispiel #19
0
 private void Start()
 {
     player_Movement = FindObjectOfType <Player_movement>();
     anim            = GetComponent <Animator>();
     collide         = GetComponent <collider_player>();
 }
Beispiel #20
0
 private void Awake() => pm = Player_movement.Instance;
Beispiel #21
0
 void Start()
 {
     player_movement = FindObjectOfType <Player_movement>();
 }
Beispiel #22
0
 private void Awake()
 {
     cm = CanvasManager.Instance;
     pm = Player_movement.Instance;
 }
 private void Start()
 {
     pm = FindObjectOfType <Player_movement>();
     DM = FindObjectOfType <Dialog_Manager>();
     GC = GameObject.FindGameObjectsWithTag("GestoreGioco")[0].GetComponent <GestoreComunicazione>();
 }
Beispiel #24
0
    private Vector3 lastplayerposition; // hol volt a player van Z értéke, de nem számít
    //private float distancetomove;

    // Use this for initialization
    void Start()
    {
        theplayer          = FindObjectOfType <Player_movement>(); // a játék elején a unity megkeresi a playert
        lastplayerposition = theplayer.transform.position;         // x,y,z, kiolvassa
    }