コード例 #1
0
    //ToDo: Make it so that the control scheme can be changed by the player.

    void Awake()
    {
        //Attaching scripts and objects.
        data   = gameObject.GetComponent <TankData>();
        move   = gameObject.GetComponent <TankMove>();
        attack = gameObject.GetComponent <TankAttack>();
    }
コード例 #2
0
ファイル: TankData.cs プロジェクト: R3M3MB3R3D/UATanks
    void Awake()
    {
        tf     = GetComponent <Transform>();
        move   = GetComponent <TankMove>();
        attack = GetComponent <TankAttack>();
        life   = GetComponent <TankLife>();

        //Removed Reverse Speed and just divided the speed
        //by 3 when moving backwards, I would have to completely
        //change Move and IController to keep and use the reverse
        //variable.
        tankForwardSpeed = 5;
        tankRotateSpeed  = 100;

        tankMaxLife     = 100;
        tankCurrentLife = 100;
        tankArmor       = 5;

        tankGunDamage         = 6;
        tankGunAmmoMax        = 100;
        tankGunAmmoCurrent    = 100;
        tankCannonDamage      = 40;
        tankCannonAmmoMax     = 10;
        tankCannonAmmoCurrent = 10;

        tankCannonFireR = 3;

        lives     = 3;
        tankScore = 0;
    }
コード例 #3
0
    private void Awake()
    {
        //Tank의 GameObject의 하위에있는 모든 Models의 MeshRenderer 컴포넌트를 추출한 후 배열에 할당합니다.
        renderers = GetComponentsInChildren <MeshRenderer>();
        _tankMove = GetComponent <TankMove>();
        playerTr  = GetComponent <Transform>();
        _rigid    = GetComponent <Rigidbody>();

        //pv = GetComponent<PhotonView>();
        //pv.synchronization = ViewSynchronization.UnreliableOnChange;
        //pv.ObservedComponents[1] = this;

        //현재 생명치를 초기 생명치로 초기화합니다.
        currentHp = initHp;

        //Tank 폴발시 생성시킬 폴발효과를 로드합니다.
        expEffect = Resources.Load <GameObject>("PlasmaExplosionEffect");

        //Filled 이미지 색상을 녹색으로 설정합니다.
        hpBar.color = Color.green;

        pv       = GetComponent <PhotonView>();
        playerId = pv.ownerId;

        //pv.synchronization = ViewSynchronization.UnreliableOnChange;
        //0번째는 TankMove로 설정되어있습니다.
        //pv.ObservedComponents[1] = this;
    }
コード例 #4
0
 void Start()
 {
     control = GetComponent <AIControl>();
     data    = GetComponent <TankData>();
     move    = GetComponent <TankMove>();
     attack  = GetComponent <TankAttack>();
     tf      = GetComponent <Transform>();
 }
コード例 #5
0
 private void Awake()
 {
     tankData     = GetComponent <TankData>();
     tankAttack   = GetComponent <TankAttack>();
     tankLife     = GetComponent <TankLife>();
     tankMove     = GetComponent <TankMove>();
     currentState = AIStates.Camp;
 }
コード例 #6
0
ファイル: ChaseFlee.cs プロジェクト: R3M3MB3R3D/UATanks2020
 void Awake()
 {
     //Attaching scripts and objects.
     data    = GetComponent <TankData>();
     move    = GetComponent <TankMove>();
     tf      = GetComponent <Transform>();
     control = GetComponent <AIControl>();
 }
コード例 #7
0
 void Awake()
 {
     //'this.gameObject.' is not required, but it leaves
     //very little to the imagination as to what the
     //reference is for.  Here we attach those variables
     //to these scripts so that they will interact.
     tf     = this.gameObject.GetComponent <Transform>();
     move   = this.gameObject.GetComponent <TankMove>();
     attack = this.gameObject.GetComponent <TankAttack>();
     life   = this.gameObject.GetComponent <TankLife>();
 }
コード例 #8
0
ファイル: TankDamage.cs プロジェクト: gus5345/Unity_DomainWar
    void Start()
    {
        hitPoint = GetComponent<HitPoint>();
        tankMove = GetComponent<TankMove>();
        fireCannon = GetComponent<FireCannon>();
        zoomImage = GameObject.Find("ZoomImage");
        respawn = GameObject.Find("Respawn").GetComponent<Text>();
        respawnTextTime = GameObject.Find("RespawnTime").GetComponent<Text>();

        if (pv.isMine)
        {
            Camera.main.GetComponent<SmoothCam>().target = camPivot;  //메인 카메라에 추가된 스크립트에 추적 대상을 연결
        }
    }
コード例 #9
0
ファイル: TankManage.cs プロジェクト: c-peckham/public
    public void Setup()
    {
        m_Movement         = m_Instance.GetComponent <TankMove> ();
        m_Shooting         = m_Instance.GetComponent <TankShoot> ();
        m_CanvasGameObject = m_Instance.GetComponentInChildren <Canvas> ().gameObject;

        m_Movement.m_PlayerNumber = m_PlayerNumber;
        m_Shooting.m_PlayerNumber = m_PlayerNumber;

        m_ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(m_PlayerColor) + ">PLAYER " + m_PlayerNumber + "</color>";
        MeshRenderer[] renderers = m_Instance.GetComponentsInChildren <MeshRenderer> ();

        for (int i = 0; i < renderers.Length; i++)
        {
            renderers [i].material.color = m_PlayerColor;
        }
    }
コード例 #10
0
ファイル: AIControl.cs プロジェクト: R3M3MB3R3D/UATanks2020
    void Start()
    {
        //Attaching scripts and objects.
        move   = GetComponent <TankMove>();
        data   = GetComponent <TankData>();
        attack = GetComponent <TankAttack>();
        tf     = GetComponent <Transform>();
        color  = GetComponent <MeshRenderer>().material;

        //Creating a way to randomly add personalities to the AI.
        identity = (Identity)Random.Range(0, System.Enum.GetNames(typeof(Identity)).Length);
        loopType = LoopType.PingPong;
        //When the identity is selected, pull the appropriate Script from Unity.
        switch (identity)
        {
        case Identity.Aggro:
            gameObject.AddComponent <AggroIdentity>();
            color.color = Color.red;
            break;

        case Identity.Guard:
            gameObject.AddComponent <GuardIdentity>();
            color.color = Color.white;
            break;

        case Identity.Sniper:
            gameObject.AddComponent <SniperIdentity>();
            color.color = Color.yellow;
            break;

        case Identity.Coward:
            gameObject.AddComponent <CowardIdentity>();
            color.color = Color.black;
            break;
        }

        foreach (GameObject waypointGo in GameManager.instance.waypoints)
        {
            waypoints.Add(waypointGo.transform);
        }
    }
コード例 #11
0
    void Start()
    {
        //Attaching scripts and objects.
        data    = GetComponent <TankData>();
        attack  = GetComponent <TankAttack>();
        move    = GetComponent <TankMove>();
        control = GetComponent <AIControl>();
        tf      = GetComponent <Transform>();

        //Setting some variables.
        currentWaypoint = 0;
        closeEnough     = 1.0f;
        patrolForward   = true;

        hearingdistance = 25f;
        FOVangle        = 45.0f;
        inSightAngle    = 10.0f;

        healthRegen = 10;
        restTime    = 5;
    }