Пример #1
0
 void Start()
 {
     cam         = Camera.main;
     character2D = PlayerManager.player.GetComponent <PlatformerCharacter2D>();
     shooting    = PlayerManager.shooting;
     rotation    = PlayerManager.rotation;
 }
 void Awake()
 {
     weapon     = GameObject.Find("Weapon").GetComponent <WeaponShooting> ();
     player     = GameObject.FindGameObjectWithTag("Player");
     health     = GameObject.Find("Player").GetComponent <PlayerHealth> ();
     weaponflag = GameObject.Find("WeaponManager 1").GetComponent <FirstAidManager> ();
 }
Пример #3
0
        public SerializedNpc(GameObject gameObject)
        {
            position = new Position(gameObject.transform.position);
            WeaponShooting enemyShooting = gameObject.GetComponentInChildren <WeaponShooting>();
            EnemyAI        enemyNpc      = gameObject.GetComponentInChildren <EnemyAI>();
            NpcStats       stats         = gameObject.GetComponent <NpcStats>();
            Npc            npc           = gameObject.GetComponentInChildren <Npc>();

            maxHealth           = stats.maxHealth;
            damage              = stats.damage;
            armour              = stats.armour;
            radiationResistance = stats.radiationResistance;
            movementSpeed       = stats.movementSpeed;
            //stats.items = stats.items;
            experienceGained = stats.experienceGained;

            radius           = npc.radius;
            dialogueFilename = npc.dialogueFilename;
            reaction         = npc.reaction;
            questNames       = new List <string>();
            questStatuses    = new List <QuestStatus>();
            npc.quests.ForEach(quest => {
                questNames.Add(quest.title);
                questStatuses.Add(quest.status);
            });

            attackSpeed = enemyShooting.meleeAttackSpeed;
            //weaponName = enemyShooting.weapon.name;

            chaseRadius  = enemyNpc.chaseRadius;
            attackRadius = enemyNpc.attackRadius;
            meleeRadius  = enemyNpc.meleeRadius;
        }
Пример #4
0
 void Awake()
 {
     floorMask       = LayerMask.GetMask("Floor");
     anim            = GetComponent <Animator> ();
     playerRigidbody = GetComponent <Rigidbody> ();
     weaponShooting  = GetComponentInChildren <WeaponShooting> ();
     temp.Set(0, 0, 0);
 }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        WeaponShooting shotgun   = FindObjectOfType <WeaponShooting>();
        Vector2        mousePos  = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector2        objectPos = new Vector2(shotgun.transform.position.x, shotgun.transform.position.y);
        Vector2        heading   = mousePos - objectPos;
        float          distance  = heading.magnitude;

        direction           = heading / distance;
        transform.position += new Vector3(direction.x * offset, direction.y * offset, 0f);
        startPosition       = transform.position;
    }
Пример #6
0
    void Awake()
    {
        player    = playerReference;
        stats     = player.GetComponent <CharacterStats>();
        equipment = player.GetComponent <Equipment>();
        inventory = player.GetComponent <Inventory>();
        shooting  = player.GetComponentInChildren <WeaponShooting>();
        rotation  = player.GetComponentInChildren <CharacterRotation>();

        DisableAI();
        SetTags();
        SetCamera();
    }
Пример #7
0
        public SerializedPlayer(GameObject player, GameObject gameMaster)
        {
            position = new Position(player.transform.position);
            CharacterStats stats    = player.GetComponent <CharacterStats>();
            WeaponShooting shooting = player.GetComponentInChildren <WeaponShooting>();

            maxHealth           = stats.currentHealth;
            damage              = stats.damage;
            armour              = stats.armour;
            radiationResistance = stats.radiationResistance;
            movementSpeed       = stats.movementSpeed;

            gameManager = new SerializedGameManager(gameMaster);
        }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        weaponShootingScript           = GetComponent <WeaponShooting>();
        weaponSwapScript               = GetComponent <WeaponSwap>();
        playerSkillScript              = GetComponent <PlayerSkills>();
        playerControllerScript         = GetComponent <PlayerController>();
        playerBuildingControllerScript = GetComponent <PlayerBuildingController>();
        playerStatsScript              = GetComponent <PlayerStats>();


        //  Set Controller States
        defaultControllerState  = new DefaultControllerState(this);
        buidlingControllerState = new BaseBuildingControllerState(this);


        currentControllerState = defaultControllerState;
    }
Пример #9
0
    // Use this for initialization
    void Start()
    {
        shotgun = FindObjectOfType <WeaponShooting>();

        Vector2 mousePos  = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector2 objectPos = new Vector2(shotgun.transform.position.x, shotgun.transform.position.y);

        Vector2 heading = mousePos - objectPos;

        float distance = heading.magnitude;

        Vector2 direction = heading / distance;
        Vector2 normal    = new Vector2(1f, 0f);

        angle = Vector2.Angle(normal, direction);

        if (mousePos.y < objectPos.y)
        {
            angle = 360f - angle;
        }
    }
Пример #10
0
 void Awake()
 {
     weapon     = GameObject.Find("Weapon").GetComponent <WeaponShooting> ();
     player     = GameObject.FindGameObjectWithTag("Player");
     weaponflag = GameObject.Find("WeaponManager 1").GetComponent <M4Manager> ();
 }
Пример #11
0
 private void Start()
 {
     weaponShootingScript = GetComponent <WeaponShooting>();
 }
Пример #12
0
 void SetEnemyShooting(WeaponShooting shooting)
 {
     shooting.meleeAttackSpeed = attackSpeed;
     //shooting.weapon = AssetsManager.GetItem(weaponName) as Weapon;
 }