Inheritance: MonoBehaviour
	// Use this for initialization
	void Awake () 
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerControl = player.GetComponent<playerControl>();
        som = gameObject.GetComponent<AudioSource>();
        bala = gameObject.GetComponent<MeshRenderer>();
	}
Ejemplo n.º 2
0
    private void Start()
    {
        dragon = GetComponent <playerControl>();

        FaceRandomGroundDirection(); // so they're not all facing the same direciton when you load the game
        State = StartState;
    }
Ejemplo n.º 3
0
    void Start()
    {
        move = GameObject.Find("FPSController").GetComponent <playerControl>();

        leftClicked  = 0;
        rightClicked = 0;

        isActive  = false;
        isTalking = false;

        showDance     = false;
        findLeave     = false;
        questComplete = false;

        if (textFiles != null)
        {
            textLines = (textFiles.text.Split('\n'));
        }

        currentLine = 0;

        if (endAtLine == 0)
        {
            endAtLine = textLines.Length - 1;
        }

        DisableTextBox();
        DisableButton();
    }
Ejemplo n.º 4
0
    public void TakeDamage(int damageAmount)
    {
        if (dying)
        {
            return;
        }

        health -= damageAmount;

        if (health <= 0)
        {
            if (photonView.IsMine)
            {
                playerControl player = GetComponent <playerControl> ();

                if (player == null)
                {
                    PhotonNetwork.Destroy(this.gameObject);
                }
                else
                {
                    //player died routine, handle this

                    player.enabled = false;
                    dying          = true;

                    player.ourRigidbody.AddForce(player.transform.up * 100, ForceMode.VelocityChange);

                    RespawnEntity();
                }
            }
        }
    }
Ejemplo n.º 5
0
	void Awake () 
    {
        shootLine = GetComponent<LineRenderer>();
        shootLuz = GetComponent<Light>();
        playerControl = player.GetComponent<playerControl>();
        somDisparo = GetComponent<AudioSource>();
	}
Ejemplo n.º 6
0
    private playerControl playerControl; //用于获取相关持续时间


    private void Awake()
    {
        playerControl = GetComponent <playerControl>();
        healthBar     = GameObject.Find("blood").GetComponent <SpriteRenderer>();
        healthScale   = healthBar.transform.localScale;
        healthPos     = GameObject.Find("blood").transform;
    }
	// Use this for initialization
	void Start () 
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerControl = GameObject.FindGameObjectWithTag("Player").GetComponent<playerControl>();
        escape = GameObject.FindGameObjectWithTag("prisioner").GetComponent<prisionerEscape>();
        audios = GetComponents<AudioSource>();
	}
Ejemplo n.º 8
0
 void Awake()
 {
     time = gameObject.AddComponent("Timer") as Timer;
     pathMemory = new Transform[3];
     playerCtrl = GameObject.Find("Player").GetComponent<playerControl>();
     anim = GetComponent<Animator>();
 }
Ejemplo n.º 9
0
 public PlayerDead(playerControl p)
 {
     player         = p;
     animator       = p.animator;
     playerBody     = p.GetComponent <Rigidbody>();
     spriteRenderer = p.GetComponent <SpriteRenderer>();
 }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     m_Rigidbory  = GetComponent <Rigidbody>();
     m_playerCtrl = GameObject.Find("footman").transform.GetComponent <playerControl>();
     m_Animator   = m_playerCtrl.anim;
     MakeFSM();
 }
Ejemplo n.º 11
0
 public PlayerShoot(playerControl p)
 {
     player     = p;
     playerBody = p.GetComponent <Rigidbody>();
     projectile = p.projectile.gameObject;
     projAtk    = projectile.GetComponent <ProjectileAttack>();
     input      = p.input;
 }
Ejemplo n.º 12
0
 void Awake()
 {
     anim           = GetComponent <Animator>();
     playerMovement = GetComponent <playerControl>();
     hash           = GameObject.FindGameObjectWithTag("MainControl").GetComponent <HashIDs>();
     //sceneFadeOut = GameObject.FindGameObjectWithTag("fader").GetComponent<SceneFadeInOut>();
     lastPlayerSighting = GameObject.FindGameObjectWithTag("MainControl").GetComponent <EnemySight>().lastPlayerSighting;
 }
Ejemplo n.º 13
0
    // Use this for initialization

    void Start()
    {
        Player = FindObjectOfType <playerControl>();
        if (Player.transform.localScale.x < 0)
        {
            speed = -speed;
        }
    }
Ejemplo n.º 14
0
    // Start is called before the first frame update
    void Start()
    {
        Transform prnt = transform.parent;

        heightOffset = transform.position.y;
        player       = GameObject.Find("player");
        playerScript = player.GetComponent <playerControl>();
    }
Ejemplo n.º 15
0
 public static playerControl singletonGetInstance()
 {
     if (_PControlInstance == null) //If no instance, make one.
     {
         _PControlInstance = new playerControl();
     }
     return(_PControlInstance);
 }
Ejemplo n.º 16
0
 public PlayerMelee(playerControl p, float hm)
 {
     player             = p;
     meleeAttack        = p.basicAttack.gameObject;
     input              = p.input;
     horizontalMovement = hm;
     animator           = p.gameObject.GetComponent <Animator>();
 }
Ejemplo n.º 17
0
 public PlayerGlide(playerControl p, glideType glideMethod)
 {
     player         = p;
     input          = p.input;
     method         = glideMethod;
     animator       = p.gameObject.GetComponent <Animator>();
     spriterenderer = p.gameObject.GetComponent <SpriteRenderer>();
 }
Ejemplo n.º 18
0
//	public bool checkpointReached;


    // Use this for initialization
    void Start()
    {
        bombSpriteRenderer = GetComponent <SpriteRenderer>();
        gamePlayer         = FindObjectOfType <playerControl>();
        //	RestartButton.SetActive(false);
        Menu.SetActive(false);
        HighScorePanel.SetActive(false);
        GameOverText.SetActive(false);
    }
Ejemplo n.º 19
0
 public PlayerDodge(playerControl p)
 {
     player         = p;
     playerRenderer = p.gameObject.GetComponent <SpriteRenderer>();
     playerColor    = playerRenderer.color;
     playerBody     = p.gameObject.GetComponent <Rigidbody>();
     animator       = p.gameObject.GetComponent <Animator>();
     input          = p.input;
 }
Ejemplo n.º 20
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        playerControl x = collision.gameObject.GetComponent <playerControl>();

        if (x != null)
        {
            SceneManager.LoadScene("win");
        }
    }
Ejemplo n.º 21
0
 public PlayerJump(playerControl p)
 {
     player           = p;
     jump             = p.gameObject.GetComponentInChildren <AudioSource>();
     playerBody       = p.gameObject.GetComponent <Rigidbody>();
     myAnimationState = "PlayerJumpUp";
     animator         = p.gameObject.GetComponent <Animator>();
     spriterenderer   = p.gameObject.GetComponent <SpriteRenderer>();
     input            = p.input;
 }
Ejemplo n.º 22
0
 public PlayerTether(playerControl p)
 {
     player          = p;
     playerRB        = p.GetComponent <Rigidbody>();
     tetherDirection = p.tetherAbility.activeTetherPoint.transform.position - playerRB.position;
     tetherLength    = tetherDirection.magnitude;
     angle           = Vector3.SignedAngle(tetherDirection, Vector3.up, Vector3.forward) * Mathf.Deg2Rad;
     animator        = p.gameObject.GetComponent <Animator>();
     spriterenderer  = p.gameObject.GetComponent <SpriteRenderer>();
     input           = p.input;
 }
Ejemplo n.º 23
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         playerControl playerController = other.gameObject.GetComponent <playerControl>();
         if (playerController != null && !playerController.IsDashing)
         {
             DestroyProjectile();
         }
     }
 }
Ejemplo n.º 24
0
    public PlayerMove(playerControl p, bool isAirborne)
    {
        player     = p;
        playerBody = p.gameObject.GetComponent <Rigidbody>();
        input      = p.input;
        isFlying   = isAirborne;

        //Trying to pass a reference to the Animator/Renderer components here.
        animator       = p.gameObject.GetComponent <Animator>();
        spriterenderer = p.gameObject.GetComponent <SpriteRenderer>();
    }
Ejemplo n.º 25
0
 // Start is called before the first frame update
 void Start()
 {
     checkpoints          = GameObject.FindGameObjectsWithTag("Checkpoint");
     groundedEnemiesArray = GameObject.FindGameObjectsWithTag("GroundedEnemy");
     CopyArray();
     playerState        = player.GetComponent <playerControl>();
     spawn              = GameObject.Find("Spawn");
     totalNumberEnemies = groundedEnemiesArray.Length;
     //groundedEnemy = GameObject.Find("GroundedEnemy");
     enemyRef = Resources.Load("GroundedEnemy"); // Will be used for cloning , typeof(GameObject)
 }
Ejemplo n.º 26
0
	// Use this for initialization
	void Awake () 
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerControl = GameObject.FindGameObjectWithTag("Player").GetComponent<playerControl>();
        chave = GetComponent<MeshRenderer>();
        enemy = GameObject.FindGameObjectWithTag("enemy").GetComponent<EnemyHealth>();
        colliderChave = gameObject.GetComponent<Collider>();
        som = gameObject.GetComponent<AudioSource>();
        colliderChave.enabled = false;
        chave.enabled = false;
        enemyKilled = false;
	}
Ejemplo n.º 27
0
 void Start()
 {
     invNum     = 0;
     timer      = 0;
     cont       = GetComponentInParent <playerControl> ();
     temp       = null;
     cameraMode = false;
     pickUp     = false;
     viewfinder.SetActive(false);
     flash = GameObject.Find("Flash").GetComponent <cameraFlash> ();
     fov   = 60;
 }
Ejemplo n.º 28
0
    // Use this for initialization
    void Start()
    {
        HP           = 2f;
        monsterSpeed = 1.5f;

        int seed = (int)(transform.position.x * 100) + (int)(transform.position.z * 100) + (int)(Time.time * 20);

        System.Random ran = new System.Random(seed);
        freeMoveCD   = constFreeMoveCD + (float)ran.Next(-100, 100) / 100;
        freeMoveTime = constFreeMoveTime + (float)ran.Next(-100, 100) / 100;

        player = GameObject.FindWithTag("Player").GetComponent <playerControl>();
        rb     = GetComponent <Rigidbody>();
    }
Ejemplo n.º 29
0
 void Start()
 {
     if(GameObject.FindGameObjectWithTag("Player")){
         player = GameObject.FindGameObjectWithTag("Player").GetComponent<playerControl>();
     }
     if(transform.parent){
         if(transform.parent.GetComponent<CanvasScaler>()){
             _canvasScale = ((CanvasScaler)transform.parent.GetComponent<CanvasScaler>()).referenceResolution;
         }
     }
     _screenScale = new Vector2(Screen.width, Screen.height);
     _orgPos = new Vector2(transform.position.x, transform.position.y);
     _currPos = _orgPos;
     adjustedMaxDis = AdjustMaxDistance();
 }
Ejemplo n.º 30
0
    void attack()
    {
        RaycastHit hit;
        Vector3    fwd = transform.TransformDirection(Vector3.forward);

        if (Physics.Raycast(transform.position, fwd, out hit, rayLength))
        {
            if (hit.collider.gameObject.tag == "Tree")
            {
                Debug.Log("Hit");
                treeScript             = GameObject.Find(hit.collider.gameObject.name).GetComponent <treectrl>();
                playerAnim             = GameObject.FindWithTag("Player").GetComponent <playerControl>();
                treeScript.treeHealth -= 1;
            }
        }
    }
Ejemplo n.º 31
0
    void Start()
    {
        healthMax    = 10;
        player       = GameObject.Find("player");
        playerScript = player.GetComponent <playerControl>();

        Debug.Log("Health: " + playerScript.data.health);

        /*
         * CMDebug.ButtonUI(new Vector2(-100, 100), "heal", () =>
         * {
         *  healthSystem.Heal(2);
         *  Debug.Log("Healed: " + healthSystem.GetHealth());
         * });
         */
    }
Ejemplo n.º 32
0
    // Old code
    //public GameObject skillButton;
    //public GameObject shieldButton;

    public void Start()
    {
        isDisplaying = true;
        player       = GameObject.Find("player");
        playerScript = player.GetComponent <playerControl>();
        playerSkills = playerScript.GetPlayerSkills();
        currency     = GameObject.Find("collectables").transform.Find("currency").gameObject.GetComponent <Collectable>();
        levelWindow  = GameObject.Find("LevelWindow").GetComponent <LevelWindow>();

        // Old code
        //skillButton = GameObject.Find("Canvas").transform.Find("ShieldButton").gameObject.GetComponent<>();
        //EventSystem.current.SetSelectedGameObject(resumeButton);
        //skillTreeButton = canvas.transform.Find("ResumeButton");
        //.GetComponent<ResumeButton>();
        //"tranform.()FindObjectOfType<ResumeGame>().gameObject;
    }
Ejemplo n.º 33
0
 void Start()
 {
     if (GameObject.FindGameObjectWithTag("Player"))
     {
         player = GameObject.FindGameObjectWithTag("Player").GetComponent <playerControl>();
     }
     if (transform.parent)
     {
         if (transform.parent.GetComponent <CanvasScaler>())
         {
             _canvasScale = ((CanvasScaler)transform.parent.GetComponent <CanvasScaler>()).referenceResolution;
         }
     }
     _screenScale   = new Vector2(Screen.width, Screen.height);
     _orgPos        = new Vector2(transform.position.x, transform.position.y);
     _currPos       = _orgPos;
     adjustedMaxDis = AdjustMaxDistance();
 }
Ejemplo n.º 34
0
    /// <summary>
    /// 根据初始数据DTO,初始化playerControl
    /// </summary>
    private void initPlayerControl(playerDTO dto)
    {
        //TODO设置DTO中的playerModel传递给playerControl以及id
        playerControl player = new playerControl(1, dto);

        //if这个id是和我方id一样的话,初始化技能面板
        //初始化技能面板
        if (dto.playerId == globalBattleControl.mainPlayerId)
        {
            mainPlayerTeamId = dto.playerTeamId;
            GameObject[] skillPanels = GameObject.FindGameObjectsWithTag("Skill");
            foreach (var item in skillPanels)
            {
                skillManager skillManager = item.GetComponent <skillManager>();
                int          i            = int.Parse(item.name.Substring(2));

                ///这里明确,技能标号从1开始
                skillManager.SetSkill(player.getPlayerModel().skillArray[i]);
            }
        }
        //初始化快捷键
        if (dto.playerId == globalBattleControl.mainPlayerId)
        {
            mainPlayerTeamId = dto.playerTeamId;
            GameObject[] skillPanels = GameObject.FindGameObjectsWithTag("ShortKey");
            foreach (var item in skillPanels)
            {
                shortKeyManager skillManager = item.GetComponent <shortKeyManager>();
                int             i            = int.Parse(item.name.Substring(3));

                ///这里明确,技能标号从1开始
                skillManager.SetSoup(player.getPlayerModel().soupArray[i]);
            }
        }

        if (dto.playerTeamId == 1)
        {
            team1Dic.Add(dto.playerId, player);
        }
        else
        {
            team2Dic.Add(dto.playerId, player);
        }
    }
Ejemplo n.º 35
0
    public static void SendGameData(byte[] data, playerControl player)
    {
        int offset = 0;

        while (offset < data.Length)
        {
            var temp = new byte[MAX_MESSAGE_SIZE];
            for (int j = 0; j < MAX_MESSAGE_SIZE; j++)
            {
                if (j + offset == data.Length)
                {
                    break;
                }
                temp[j] = data[offset + j];
            }
            player.RpcGetGameData(temp, offset);
            offset += MAX_MESSAGE_SIZE;
        }
    }
Ejemplo n.º 36
0
    //https://forum.unity.com/threads/character-align-to-surface-normal.33987
    void Start()
    {
        if (planetCollider == null)
        {
            centre = transform;
            radius = 0;
        }
        else
        {
            //consider scale applied to planet transform (assuming uniform, just pick one)
            radius = planetCollider.radius * planetCollider.transform.localScale.y;
            centre = planetCollider.transform;
        }

        ourPlayer = GetComponent <playerControl> ();
        ourPlayer.ourGravityPlayer = this;
        //starting position at north pole
        // transform.position = centre.position + new Vector3(0,radius+height,0);
    }
Ejemplo n.º 37
0
	// Use this for initialization
	void Start () 
    {
        player = GetComponentInParent<playerControl>();
        lanterna.enabled = false;
	}
Ejemplo n.º 38
0
 // Use this for initialization
 void Start()
 {
     HideBut();
     playerCtrl = GameObject.Find("Player").GetComponent<playerControl>();
 }
Ejemplo n.º 39
0
 void Start()
 {
     p1Selected = char1;
     p2Selected = char2;
     playerTracker.pT.p1.GetComponent<playerData>().playNum = 1;
     playerTracker.pT.p1.GetComponent<playerData>().charNum = 1;
     playerTracker.pT.p2.GetComponent<playerData>().playNum = 2;
     playerTracker.pT.p2.GetComponent<playerData>().charNum = 2;
     fightManager.fM.selCharacter = this;
     p1C = playerTracker.pT.p1.GetComponent<playerControl>();
     p2C = playerTracker.pT.p2.GetComponent<playerControl>();
 }
Ejemplo n.º 40
0
 // Use this for initialization
 void Start()
 {
     prePos = currentPos;
     playerCtrl = GameObject.Find("Player").GetComponent<playerControl>();
     points = CameraPositions.loadFirstLvl();
 }